From 729f21c10640d3a9c682d5bf3270335e5782563e Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Fri, 15 Sep 2017 08:10:16 +0200 Subject: [PATCH] Reading bash-it help lists aliases from global enabled directory --- lib/helpers.bash | 5 +---- test/lib/helpers.bats | 9 ++++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index 2fbe2af1..5c6ecb00 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -454,15 +454,12 @@ _help-aliases() cat "${BASH_IT}/aliases/$alias_path" | metafor alias | sed "s/$/'/" else typeset f - shopt -s nullglob - for f in "${BASH_IT}/aliases/enabled/"* + for f in `sort <(compgen -G "${BASH_IT}/aliases/enabled/*") <(compgen -G "${BASH_IT}/enabled/*.aliases.bash")` do _help-list-aliases $f done - shopt -u nullglob - if [ -e "${BASH_IT}/aliases/custom.aliases.bash" ]; then _help-list-aliases "${BASH_IT}/aliases/custom.aliases.bash" fi diff --git a/test/lib/helpers.bats b/test/lib/helpers.bats index 7116aba2..c6ac7e3f 100644 --- a/test/lib/helpers.bats +++ b/test/lib/helpers.bats @@ -90,10 +90,13 @@ function local_setup { assert_line "0" 'ag enabled with priority 150.' assert [ -L "$BASH_IT/enabled/150---ag.aliases.bash" ] - run bash-it help aliases + run bash-it enable plugin "aws" + assert_line "0" 'aws enabled with priority 250.' + assert [ -L "$BASH_IT/enabled/250---aws.plugin.bash" ] - echo "${lines[@]}" - assert_line "2" "foo" + run bash-it help aliases + assert_line "0" "ag:" + assert_line "1" "ag='ag --smart-case --pager=\"less -MIRFX'" } @test "helpers: enable the todo.txt-cli aliases through the bash-it function" {