]> git.tuebingen.mpg.de Git - gsu.git/commitdiff
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 6011ee68aad6b88103455167ea129008da1ec792..a9d388ba05232f49ac5f8adf37fd9f0df1a2ca45 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