diff --git a/README.md b/README.md index c94c99e..5f52e51 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,9 @@ clone this repo ``` chmod +x genlog.sh ``` -put your files in the "content" folder - your .gmi files are converted in html and concatenated with the html/header.html and the html/footer.html the .html file is witen in the directory of the .gmi file which has been treated -this script will recursively search all .gmi files contained in the "content" folder, even in the other folders it includes +this script will recursively search all .gmi files contained in the "content" folder or a path given as an argument to the script, even in the other folders it includes feel free to customize the html/header.html and the html/footer.html as you like @@ -23,3 +21,12 @@ please keep the ``` in the html/header.html file if you want your generated pages to have a properly defined title in the HTML + +## usage + +put your files in the "content" folder +``` ./genlog.sh ``` + +or + +``` ./genlog.sh /path/to/your/choosen/folder ``` diff --git a/genlog.sh b/genlog.sh index a5625d1..db597e5 100755 --- a/genlog.sh +++ b/genlog.sh @@ -3,8 +3,18 @@ # on créé un répertoire de taff temporaire pour foutre nos fichiers en cours de traitement dedans tempdir="$(mktemp -d)" -# on cherche récursivement tous les fichiers ".gmi" dans le dossier "content" -find "${PWD}"/content -wholename "*.gmi" -type f | while read -r gmi_file +# on vérifie s'il y a un argument passé à notre script +if "$1" +then + # si oui, on l'utilise comme path ou aller taffer + source_path="$1" +else + # sinon on utilise le dossier "content" + source_path="${PWD}"/content +fi + +# on cherche récursivement tous les fichiers ".gmi" dans le dossier de taff +find "$source_path" -wholename "*.gmi" -type f | while read -r gmi_file do # récupérer la 1ère ligne du fichier .gmi et remplacer "# " par ""