From: Matthias Kruk Date: Mon, 21 Jun 2021 23:49:42 +0000 (+0900) Subject: include/{opt,inst}: Add regex parameter to opt_add_arg() calls X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=f383283e534c4afeb80405687058679f023d4c4a;p=toolbox 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. --- 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