From f383283e534c4afeb80405687058679f023d4c4a Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Tue, 22 Jun 2021 08:49:42 +0900 Subject: [PATCH] include/{opt,inst}: Add regex parameter to opt_add_arg() calls The opt and inst modules use opt_add_arg() to register command line arguments with a callback, however they omit the newly-added regex argument, causing the callbacks not to be called. This commit fixes the order of arguments passed to opt_add_arg() so that the command line arguments are registered correctly. --- include/inst.sh | 4 ++-- include/opt.sh | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/inst.sh b/include/inst.sh index 678a2ae..9d627d3 100644 --- a/include/inst.sh +++ b/include/inst.sh @@ -37,8 +37,8 @@ __init() { return 1 fi - opt_add_arg "l" "list" "" 0 "List running instances" _inst_handle_opt - opt_add_arg "s" "stop" "v" "" "Stop a running instance" _inst_handle_opt + opt_add_arg "l" "list" "" 0 "List running instances" '' _inst_handle_opt + opt_add_arg "s" "stop" "v" "" "Stop a running instance" '^[0-9]+$' _inst_handle_opt return 0 } diff --git a/include/opt.sh b/include/opt.sh index a4ac69e..3a32b5a 100644 --- a/include/opt.sh +++ b/include/opt.sh @@ -38,13 +38,16 @@ __init() { opt_add_arg "h" "help" "" 0 \ "Print this text" \ + '' \ opt_print_help opt_add_arg "v" "verbose" "" 0 \ "Be more verbose" \ + '' \ log_increase_verbosity opt_add_arg "q" "quiet" "" 0 \ "Be less verbose" \ + '' \ log_decrease_verbosity return 0 -- 2.47.3