Skip to content

Commit 5828fcd

Browse files
committed
lib/helpers: delete _bash-it-determine-component-status-from-path()
Duplicate function of existing `_bash-it-component-item-is-enabled()`.
1 parent 8f612c5 commit 5828fcd

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

lib/helpers.bash

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -525,15 +525,15 @@ function _bash-it-profile-save() {
525525
local component_exists="" f
526526
echo "Saving $subdirectory configuration..."
527527
for f in "${BASH_IT}/$subdirectory/available/"*.bash; do
528-
_bash-it-determine-component-status-from-path "$f"
529-
if [[ "$enabled" == "x" ]]; then
528+
if _bash-it-component-item-is-enabled "$f"; then
530529
if [[ -z "$component_exists" ]]; then
531530
# This is the first component of this type, print the header
532531
component_exists="yes"
533532
something_exists="yes"
534533
echo "" >> "$profile_path"
535534
echo "# $subdirectory" >> "$profile_path"
536535
fi
536+
enabled_file="$(_bash-it-get-component-name-from-path "$f")"
537537
echo "$subdirectory $enabled_file" >> "$profile_path"
538538
fi
539539
done
@@ -682,19 +682,6 @@ function _bash-it-reload() {
682682
popd > /dev/null || return
683683
}
684684

685-
_bash-it-determine-component-status-from-path() {
686-
_about 'internal function used to process component name and check if its enabled'
687-
_param '1: full path to available component file'
688-
_example '$ _bash-it-determine-component-status-from-path "${BASH_IT}/plugins/available/git.plugin.bash'
689-
690-
# Check for both the old format without the load priority, and the extended format with the priority
691-
enabled_file="${f##*/}"
692-
enabled_file="${enabled_file%."${file_type}"*.bash}"
693-
enabled=
694-
_bash-it-component-item-is-enabled "${file_type}" "${enabled_file}" && enabled='x'
695-
return 0
696-
}
697-
698685
function _bash-it-describe() {
699686
_about 'summarizes available bash_it components'
700687
_param '1: subdirectory'
@@ -709,11 +696,12 @@ function _bash-it-describe() {
709696
file_type="$3"
710697
column_header="$4"
711698

712-
local f
713-
local enabled enabled_file
714699
printf "%-20s %-10s %s\n" "$column_header" 'Enabled?' 'Description'
715700
for f in "${BASH_IT?}/$subdirectory/available"/*.*.bash; do
716-
_bash-it-determine-component-status-from-path "$f"
701+
enabled=''
702+
enabled_file="${f##*/}"
703+
enabled_file="${enabled_file%."${file_type}"*.bash}"
704+
_bash-it-component-item-is-enabled "${file_type}" "${enabled_file}" && enabled='x'
717705
printf "%-20s %-10s %s\n" "$enabled_file" "[${enabled:- }]" "$(metafor "about-$file_type" < "$f")"
718706
done
719707
printf '\n%s\n' "to enable $preposition $file_type, do:"

0 commit comments

Comments
 (0)