From ee44ceaa94b02a999d8caa9b05edcd3cb7b6b62b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig-=C3=98rjan=20Smelror?= Date: Wed, 31 Jan 2024 16:51:48 +0100 Subject: [PATCH] Debug zsh --- qsgen2 | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/qsgen2 b/qsgen2 index 4e9bd9b..5cb235c 100755 --- a/qsgen2 +++ b/qsgen2 @@ -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() {