Debug zsh

This commit is contained in:
Stig-Ørjan Smelror 2024-01-31 16:51:48 +01:00
parent 2519d2fce1
commit ee44ceaa94

29
qsgen2
View File

@ -1,4 +1,6 @@
#!/usr/bin/zsh -x
#!/usr/bin/zsh
set -x
# Quick Site Generator 2 is a static website generator inspired by Nikola.
# It is written for the Z shell (zsh) because that's what I use and also because I like it better than Bash.
@ -93,7 +95,7 @@ zmodload zsh/files
# Check for, an source, the config file for this specific website
if [[ -f $(pwd)/config ]]; then
if (${debug}) echo "${red}Config file found and sourced${end}\n${yellow} - $(pwd)/config${end}"
if (${debug}); then echo "${red}Config file found and sourced${end}\n- ${yellow} - $(pwd)/config${end}"; fi
# CONFIG=$(pwd)/config
builtin source $(pwd)/config
else
@ -101,16 +103,23 @@ else
echo "${yellow} - Please create the file 'config' in your project directory.${end}"
exit
fi
debug=true
if (${debug}); then
qsconfig=$( cat $(pwd)/config | grep -v \# )
qsconfig=$(<${qsconfig})
echo "${red}Contents of Config file:${end}"
echo "${yellow} - site_name=${site_name}${end}"
echo "${yellow} - site_tagline=${site_tagline}${end}"
echo "${yellow} - theme=${theme}${end}"
echo "${yellow} - project_dir=${project_dir}${end}"
echo "${yellow} - www_root=${www_root}${end}"
echo "${yellow} - blog_in_index=${blog_in_index}${end}"
echo "${yellow} - generator=${generator}${end}"
for lines in ${qsconfig}
do
echo "${yellow} - ${lines}${end}"
done
#echo "${yellow} - site_name=${site_name}${end}"
#echo "${yellow} - site_tagline=${site_tagline}${end}"
#echo "${yellow} - theme=${theme}${end}"
#echo "${yellow} - project_dir=${project_dir}${end}"
#echo "${yellow} - www_root=${www_root}${end}"
#echo "${yellow} - blog_in_index=${blog_in_index}${end}"
#echo "${yellow} - generator=${generator}${end}"
#echo "${yellow} - sitemap=${sitemap}${end}"
fi
function _msg() {