lib/helpers: fix `_bash-it-describe()`
parent
9c0415c41e
commit
778db5aaad
|
|
@ -521,21 +521,20 @@ function _bash-it-describe() {
|
||||||
file_type="$3"
|
file_type="$3"
|
||||||
column_header="$4"
|
column_header="$4"
|
||||||
|
|
||||||
local f
|
local f ff
|
||||||
local enabled
|
local enabled enabled_file
|
||||||
printf "%-20s%-10s%s\n" "$column_header" 'Enabled?' 'Description'
|
printf "%-20s%-10s%s\n" "$column_header" 'Enabled?' 'Description'
|
||||||
for f in "${BASH_IT}/$subdirectory/available"/*.bash; do
|
for f in "${BASH_IT?}/$subdirectory/available"/*.bash; do
|
||||||
# Check for both the old format without the load priority, and the extended format with the priority
|
# Check for both the old format without the load priority, and the extended format with the priority
|
||||||
declare enabled_files enabled_file
|
|
||||||
enabled_file="${f##*/}"
|
enabled_file="${f##*/}"
|
||||||
enabled_files=$(sort <(compgen -G "${BASH_IT}/enabled/*$BASH_IT_LOAD_PRIORITY_SEPARATOR${enabled_file}") <(compgen -G "${BASH_IT}/$subdirectory/enabled/${enabled_file}") <(compgen -G "${BASH_IT}/$subdirectory/enabled/*$BASH_IT_LOAD_PRIORITY_SEPARATOR${enabled_file}") | wc -l)
|
|
||||||
|
|
||||||
if [[ "$enabled_files" -gt 0 ]]; then
|
enabled=
|
||||||
enabled='x'
|
for ff in "${BASH_IT}/enabled"/*"${BASH_IT_LOAD_PRIORITY_SEPARATOR?}${enabled_file}" \
|
||||||
else
|
"${BASH_IT}/${subdirectory}/enabled/${enabled_file}" \
|
||||||
enabled=' '
|
"${BASH_IT}/${subdirectory}/enabled"/*"${BASH_IT_LOAD_PRIORITY_SEPARATOR?}${enabled_file}"; do
|
||||||
fi
|
[[ -f "${ff}" ]] && enabled='x'
|
||||||
printf "%-20s%-10s%s\n" "$(basename "$f" | sed -e 's/\(.*\)\..*\.bash/\1/g')" " [$enabled]" "$(metafor "about-$file_type" < "$f")"
|
done
|
||||||
|
printf "%-20s %-10s %s\n" "${enabled_file%.$3*.bash}" "[${enabled:- }]" "$(metafor "about-$file_type" < "$f")"
|
||||||
done
|
done
|
||||||
printf '\n%s\n' "to enable $preposition $file_type, do:"
|
printf '\n%s\n' "to enable $preposition $file_type, do:"
|
||||||
printf '%s\n' "$ bash-it enable $file_type <$file_type name> [$file_type name]... -or- $ bash-it enable $file_type all"
|
printf '%s\n' "$ bash-it enable $file_type <$file_type name> [$file_type name]... -or- $ bash-it enable $file_type all"
|
||||||
|
|
|
||||||
|
|
@ -583,5 +583,5 @@ function __migrate_all_components() {
|
||||||
|
|
||||||
@test "helpers: describe the todo.txt-cli aliases without enabling them" {
|
@test "helpers: describe the todo.txt-cli aliases without enabling them" {
|
||||||
run _bash-it-aliases
|
run _bash-it-aliases
|
||||||
assert_line "todo.txt-cli [ ] todo.txt-cli abbreviations"
|
assert_line "todo.txt-cli [ ] todo.txt-cli abbreviations"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue