From: Andre Noll Date: Sun, 5 Mar 2017 21:17:25 +0000 (+0100) Subject: subcommand: Get rid of global $gsu_cmds. X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=786bfe5f3ee1d8ff8bf6eca1836cf93179a3020c;p=gsu.git subcommand: Get rid of global $gsu_cmds. It is only used in _gsu_print_available_commands() so we may make it local to this function. --- diff --git a/subcommand b/subcommand index 6011ee6..a9d388b 100644 --- a/subcommand +++ b/subcommand @@ -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