subcommand: Get rid of global $gsu_cmds.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 5 Mar 2017 21:17:25 +0000 (22:17 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 15 Apr 2017 15:45:21 +0000 (17:45 +0200)
It is only used in _gsu_print_available_commands() so we may
make it local to this function.

subcommand

index 6011ee6..a9d388b 100644 (file)
@@ -52,11 +52,13 @@ _gsu_available_commands()
 
 _gsu_print_available_commands()
 {
-       local cmd
+       local cmd cmds
        local -i count=0
 
+       _gsu_available_commands
+       cmds="$result"
        printf 'Available commands:\n'
-       for cmd in $gsu_cmds; do
+       for cmd in $cmds; do
                printf '%s' "$cmd"
                let ++count
                if (($count % 4)); then
@@ -530,8 +532,7 @@ gsu_get_unnamed_arg_num()
 gsu()
 {
        local i
-       _gsu_available_commands
-       gsu_cmds="$result"
+
        if (($# == 0)); then
                _gsu_usage
                _gsu_print_available_commands