From 786bfe5f3ee1d8ff8bf6eca1836cf93179a3020c Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 5 Mar 2017 22:17:25 +0100 Subject: [PATCH] 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. --- subcommand | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 -- 2.39.5