qsgen2: Add message when running in force mode

This commit is contained in:
Stig-Ørjan Smelror 2024-02-04 18:46:23 +01:00
parent 7b6d1935f5
commit b5dd211ed5

45
qsgen2
View File

@ -129,28 +129,6 @@ fi
blog_cache_file="${project_dir}/.blog_cache"
pages_cache_file="${project_dir}/.pages_cache"
case "$1" in
add)
if [[ $# -eq 3 ]]; then
_add_site "$2" "$3"
else
echo "Usage: qsgen2 add \"Site Name\" \"/path/to/project\""
fi
exit
;;
list)
_list_sites
exit
;;
force)
: >| "$blog_cache_file" # Truncate the blog cache before doing update
: >| "$pages_cache_file" # Truncate the page cache before doing update
;;
*)
#echo "Usage: qsgen2 [command]"
;;
esac
function _msg() {
# Use this function to write out messages based on their type
# Types are: std=green - info=yellow - debug=red other=bold_yellow
@ -178,6 +156,29 @@ function _msg() {
esac
}
case "$1" in
add)
if [[ $# -eq 3 ]]; then
_add_site "$2" "$3"
else
echo "Usage: qsgen2 add \"Site Name\" \"/path/to/project\""
fi
exit
;;
list)
_list_sites
exit
;;
force)
_msg sub "- Forced Update: Generating Everything"
: >| "$blog_cache_file" # Truncate the blog cache before doing update
: >| "$pages_cache_file" # Truncate the page cache before doing update
;;
*)
#echo "Usage: qsgen2 [command]"
;;
esac
# Let's check if qsgen2 can generate this site by checking if 'generator' is available
if [[ ! ${generator} ]] || [[ -d $(pwd)/.git ]]; then
_msg sub "${0:t} cannot parse this site. Exiting."