Sorting compgen output so that the returned values are in ascending order

pull/1043/head
Nils Winkler 2017-09-15 08:10:15 +02:00
parent e7298a5303
commit 7a3603f80d
2 changed files with 5 additions and 5 deletions

View File

@ -10,7 +10,7 @@ _bash-it-comp-list-available-not-enabled()
{ {
subdirectory="$1" subdirectory="$1"
local available_things=$(for f in `ls -1 "${BASH_IT}/$subdirectory/available/"*.bash 2>/dev/null`; local available_things=$(for f in `compgen -G "${BASH_IT}/$subdirectory/available/*.bash" | sort`;
do do
if [ ! -e "${BASH_IT}/$subdirectory/enabled/"$(basename $f) ] && [ ! -e "${BASH_IT}/$subdirectory/enabled/"*$BASH_IT_LOAD_PRIORITY_SEPARATOR$(basename $f) ] if [ ! -e "${BASH_IT}/$subdirectory/enabled/"$(basename $f) ] && [ ! -e "${BASH_IT}/$subdirectory/enabled/"*$BASH_IT_LOAD_PRIORITY_SEPARATOR$(basename $f) ]
then then
@ -25,7 +25,7 @@ _bash-it-comp-list-enabled()
{ {
subdirectory="$1" subdirectory="$1"
local enabled_things=$(for f in `compgen -G "${BASH_IT}/$subdirectory/enabled/*.bash"`; local enabled_things=$(for f in `compgen -G "${BASH_IT}/$subdirectory/enabled/*.bash" | sort`;
do do
basename $f | cut -d'.' -f1 | sed -e "s/^[0-9]*---//g" basename $f | cut -d'.' -f1 | sed -e "s/^[0-9]*---//g"
done) done)
@ -37,7 +37,7 @@ _bash-it-comp-list-available()
{ {
subdirectory="$1" subdirectory="$1"
local enabled_things=$(for f in `compgen -G "${BASH_IT}/$subdirectory/available/*.bash"`; local enabled_things=$(for f in `compgen -G "${BASH_IT}/$subdirectory/available/*.bash" | sort`;
do do
basename $f | cut -d'.' -f1 basename $f | cut -d'.' -f1
done) done)

View File

@ -9,5 +9,5 @@ if [ -z "${BASH_IT}" ]; then
export BASH_IT=$(cd ${test_directory} && dirname $(pwd)) export BASH_IT=$(cd ${test_directory} && dirname $(pwd))
fi fi
# exec $bats_executable ${CI:+--tap} ${test_directory}/completion exec $bats_executable ${CI:+--tap} ${test_directory}/completion
exec $bats_executable ${CI:+--tap} ${test_directory}/{bash_it,completion,install,lib,plugins,themes} # exec $bats_executable ${CI:+--tap} ${test_directory}/{bash_it,completion,install,lib,plugins,themes}