_blog_cache: Squash output to console

This commit is contained in:
Stig-Ørjan Smelror 2024-01-31 22:22:22 +01:00
parent 181f8a4dcd
commit f802e2425d

23
qsgen2
View File

@ -168,16 +168,19 @@ export blogdate=$( date +%a-%Y-%b-%d )
# Let's create arrays of all the files we'll be working on # Let's create arrays of all the files we'll be working on
function _list_blog() { function _list_blogs() {
local debug=false local debug=false
export no_blogs_found=false
# Temporarily set null_glob for this function # Temporarily set null_glob for this function
setopt local_options null_glob setopt local_options null_glob
# Check if there are any .blog files in the blog directory # Check if there are any .blog files in the blog directory
local blog_files=(blog/*.blog) local blog_files=(blog/*.blog)
if (( ${#blog_files} == 0 )); then if (( ${#blog_files} == 0 )); then
if (${debug}); then _msg debug "_list_blog: No blog files found."; fi if (${debug}); then _msg debug "_list_blogs: No blog files found."; fi
export no_blogs_found=true
return return
fi fi
@ -190,12 +193,8 @@ function _list_blog() {
function _blog_cache() { function _blog_cache() {
local debug=false local debug=false
# Check if there are any .blog files in the blog directory _list_blogs
local blog_files=(blog/*.blog)
if [[ ! -f ${blog_files[1]} ]]; then
if (${debug}); then _msg debug "_blog_cache: No blog files found."; fi
return
fi
# Create an associative array for the blog cache # Create an associative array for the blog cache
typeset -A blog_cache typeset -A blog_cache
@ -211,7 +210,7 @@ function _blog_cache() {
make_blog_array=() make_blog_array=()
# Process blog files # Process blog files
for blog_file in $(ls -har blog/*.blog); do for blog_file in ${blogs_file_array[@]}; do
# Compute the current blog file hash # Compute the current blog file hash
current_hash=$(md5sum "$blog_file" | awk '{print $1}') current_hash=$(md5sum "$blog_file" | awk '{print $1}')
@ -449,9 +448,9 @@ function _blogs() {
local debug=false local debug=false
# Running function _list_blog # Running function _list_blogs
if (${debug}) _msg debug "_blogs: Running function _list_blog" if (${debug}) _msg debug "_blogs: Running function _list_blogs"
_list_blog _list_blogs
# Running function _blog_cache # Running function _blog_cache
if (${debug}) _msg debug "_blogs: Running function _blog_cache" if (${debug}) _msg debug "_blogs: Running function _blog_cache"
_blog_cache _blog_cache