add --clean switch

This commit is contained in:
Akbar Rahman 2021-05-01 13:37:57 +01:00
parent b452df9822
commit 02246ff26e

View File

@ -1,7 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
[[ "$1" == "--help" ]] && echo "USAGE: $0 [NOTES_DIRECTORY_1 [NOTES_DIRECTORY_2 [...]]]" && exit 0
# set default config values, load user config, export config variables # set default config values, load user config, export config variables
name="" name=""
@ -28,6 +26,17 @@ export index_template
export stylesheet export stylesheet
[[ "$1" == "--help" ]] && echo "USAGE: $0 [NOTES_DIRECTORY_1 [NOTES_DIRECTORY_2 [...]]]" && exit 0
[[ "$1" == "--clean" ]] && {
find -name ".2web" -exec rm {} \;
rm -rf "$output"
exit 0
}
mkdir -p "$output"
function _renderarticle { function _renderarticle {
echo "rendering $1" echo "rendering $1"
mkdir -p "$(dirname "$output/${1}.html")" mkdir -p "$(dirname "$output/${1}.html")"