_list_pages: Rewrite
This commit is contained in:
parent
c2f84efbd8
commit
8a33d4488b
20
qsgen2
20
qsgen2
@ -146,23 +146,27 @@ export blogdate=$( date +%a-%Y-%b-%d )
|
|||||||
function _list_pages() {
|
function _list_pages() {
|
||||||
local debug=true
|
local debug=true
|
||||||
|
|
||||||
|
# Initialize or clear the array to ensure it's empty before adding files
|
||||||
|
pages_file_array=()
|
||||||
|
|
||||||
export no_pages_found=false
|
export no_pages_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
|
||||||
|
|
||||||
|
# Using an array to directly capture matching files
|
||||||
|
local -a pages_files=(*.${file_ext})
|
||||||
|
|
||||||
# Check if there are any .blog files in the blog directory
|
|
||||||
local pages_files=$(ls *.${file_ext})
|
|
||||||
if (( ${#pages_files} == 0 )); then
|
if (( ${#pages_files} == 0 )); then
|
||||||
if (${debug}); then _msg debug "_list_pages: No Pages found with ext ${file_ext}."; fi
|
if ${debug}; then _msg debug "_list_pages: No Pages found with ext ${file_ext}."; fi
|
||||||
export no_pages_found=true
|
export no_pages_found=true
|
||||||
return
|
return
|
||||||
fi
|
else
|
||||||
|
for file in "${pages_files[@]}"; do
|
||||||
for file in $( echo ${pages_files} ); do
|
if ${debug}; then _msg debug "_list_pages: Adding file to array: ${file}"; fi
|
||||||
if (${debug}) _msg debug "_list_pages: Adding file to array: ${file}"
|
|
||||||
pages_file_array+=("$file")
|
pages_file_array+=("$file")
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _list_blogs() {
|
function _list_blogs() {
|
||||||
|
Loading…
Reference in New Issue
Block a user