Skip to content

Commit 9aff29c

Browse files
ggtrdggtrd
authored andcommitted
roll back to .sh subcommands extension only
1 parent c2ff5fe commit 9aff29c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

bashpack.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ file_sourceslist_subcommands="$dir_sourceslist/subcommands.list"
163163
file_registry="$dir_sourceslist/.subcommands.registry"
164164

165165

166-
subcommands_allowed_extensions="\|sh\|"
166+
subcommands_allowed_extensions="\|sh\|bash"
167167

168168

169169
file_repository_reachable_tmp="$dir_tmp/$NAME_LOWERCASE-last-repository-tested-is-reachable"
@@ -1669,7 +1669,8 @@ subcommand_list() {
16691669
subcommand_get() {
16701670

16711671
local command="$1"
1672-
local file_command="$dir_commands/$command"
1672+
local file_command="$dir_commands/$command.sh"
1673+
# local file_command="$dir_commands/$command.$subcommands_allowed_extensions"
16731674

16741675

16751676

@@ -1682,7 +1683,7 @@ subcommand_get() {
16821683
# subcommand_list
16831684
# fi
16841685

1685-
# Refresh list according to sources list (repositories might be commented or removed since last time)
1686+
# Refresh list according to sources list (repositories might be commented or removed since last time)
16861687
subcommand_list refresh-only
16871688

16881689
local url="$(get_config_value $file_registry $command)"
@@ -1754,7 +1755,8 @@ subcommand_get() {
17541755
subcommand_delete() {
17551756

17561757
local command="$1"
1757-
local file_command="$dir_commands/$command"
1758+
local file_command="$dir_commands/$command.sh"
1759+
# local file_command="$dir_commands/$command.$subcommands_allowed_extensions"
17581760

17591761
local confirmation="$2"
17601762

@@ -2270,8 +2272,10 @@ case "$1" in
22702272
*)
22712273
# Dynamically get availables commands or display error in case of not found
22722274
# if [ -d $dir_commands ] && [ "$1" = "$(find $dir_commands/ -name "$1*" -printf "%f\n")" ]; then
2273-
if [ -d $dir_commands ] && [ "$1" = "$(ls $dir_commands | grep -w $1)" ]; then
2274-
"$dir_commands/$1" "$@"
2275+
# if [ -d $dir_commands ] && [ "$1" = "$(find $dir_commands/ -name "$1*" -printf "%f\n" | sed "s|.sh||")" ]; then
2276+
# if [ -d $dir_commands ] && [ "$1" = "$(ls $dir_commands | grep "$1")" ]; then
2277+
if [ -d $dir_commands ] && [ "$1" = "$(ls $dir_commands | grep "$1" | sed "s|.sh||")" ]; then
2278+
"$dir_commands/$1.sh" "$@"
22752279
else
22762280
log_error "unknown command '$1'." && echo "$USAGE" && exit
22772281
fi

0 commit comments

Comments
 (0)