From c2a56c6c09bb6f9290206fda4678b97944a4f187 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Sun, 1 Nov 2020 21:15:06 +0100 Subject: [PATCH] Drop this broken catch-all Closes https://git.autonomic.zone/coop-cloud/abra/issues/29. --- abra | 131 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 64 insertions(+), 67 deletions(-) diff --git a/abra b/abra index a8e3105..9e98ebf 100755 --- a/abra +++ b/abra @@ -32,7 +32,6 @@ Usage: abra [options] server use abra [options] server init abra [options] upgrade - abra [options] [...] Options: -e, --env= Environment variables to load @@ -142,12 +141,12 @@ eval "var_$1+=($value)"; else eval "var_$1=$value"; fi; return 0; fi; done return 1; }; stdout() { printf -- "cat <<'EOM'\n%s\nEOM\n" "$1"; }; stderr() { printf -- "cat <<'EOM' >&2\n%s\nEOM\n" "$1"; }; error() { [[ -n $1 ]] && stderr "$1"; stderr "$usage"; _return 1; }; _return() { -printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:1399} -usage=${DOC:40:1091}; digest=20a44; shorts=(-s -e -h -v '' '' '' '' '' '' '') -longs=(--stack --env --help --version --server --domain --pass --auto --force --user --all) -argcounts=(1 1 0 0 1 1 0 0 0 1 0); node_0(){ value __stack 0; }; node_1(){ -value __env 1; }; node_2(){ switch __help 2; }; node_3(){ switch __version 3; } -node_4(){ value __server 4; }; node_5(){ value __domain 5; }; node_6(){ +printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:1360} +usage=${DOC:40:1052}; digest=62c18; shorts=(-e -v -h -s '' '' '' '' '' '' '') +longs=(--env --version --help --stack --server --domain --pass --auto --force --user --all) +argcounts=(1 0 0 1 1 1 0 0 0 1 0); node_0(){ value __env 0; }; node_1(){ +switch __version 1; }; node_2(){ switch __help 2; }; node_3(){ value __stack 3 +}; node_4(){ value __server 4; }; node_5(){ value __domain 5; }; node_6(){ switch __pass 6; }; node_7(){ switch __auto 7; }; node_8(){ switch __force 8; } node_9(){ value __user 9; }; node_10(){ switch __all 10; }; node_11(){ value _app_ a; }; node_12(){ value _domain_ a; }; node_13(){ value _service_ a @@ -155,61 +154,60 @@ value _app_ a; }; node_12(){ value _domain_ a; }; node_13(){ value _service_ a value _args_ a true; }; node_17(){ value _secret_ a; }; node_18(){ value _version_ a; }; node_19(){ value _cmd_ a; }; node_20(){ value _data_ a; } node_21(){ value _host_ a; }; node_22(){ value _user_ a; }; node_23(){ -value _port_ a; }; node_24(){ value _command_ a; }; node_25(){ _command app; } -node_26(){ _command new; }; node_27(){ _command list; }; node_28(){ _command ls -}; node_29(){ _command deploy; }; node_30(){ _command undeploy; }; node_31(){ -_command config; }; node_32(){ _command delete; }; node_33(){ _command rm; } -node_34(){ _command logs; }; node_35(){ _command multilogs; }; node_36(){ -_command cp; }; node_37(){ _command run; }; node_38(){ _command secret; } -node_39(){ _command auto; }; node_40(){ _command generate; }; node_41(){ -_command insert; }; node_42(){ _command server; }; node_43(){ _command add; } -node_44(){ _command use; }; node_45(){ _command init; }; node_46(){ -_command upgrade; }; node_47(){ optional 0 1 2 3; }; node_48(){ optional 47; } -node_49(){ optional 4; }; node_50(){ optional 5; }; node_51(){ optional 6; } -node_52(){ optional 7; }; node_53(){ required 48 25 26 49 50 51 52 11; } -node_54(){ either 27 28; }; node_55(){ required 54; }; node_56(){ -required 48 25 55; }; node_57(){ required 48 25 12 29; }; node_58(){ -required 48 25 12 30; }; node_59(){ required 48 25 12 31; }; node_60(){ -either 32 33; }; node_61(){ required 60; }; node_62(){ optional 8; }; node_63(){ -required 48 25 12 61 62; }; node_64(){ optional 13; }; node_65(){ -required 48 25 12 34 64; }; node_66(){ required 48 25 12 35; }; node_67(){ -required 48 25 12 36 14 15; }; node_68(){ optional 9; }; node_69(){ oneormore 16 -}; node_70(){ required 48 25 12 37 68 13 69; }; node_71(){ -required 48 25 12 37 13 69; }; node_72(){ required 48 25 12 38 39; }; node_73(){ -optional 19; }; node_74(){ required 48 25 12 38 40 17 18 73 51; }; node_75(){ -required 48 25 12 38 41 17 18 20 51; }; node_76(){ either 17 10; }; node_77(){ -required 76; }; node_78(){ required 48 25 12 38 61 77 51 62; }; node_79(){ -optional 22; }; node_80(){ optional 23; }; node_81(){ required 48 42 43 21 79 80 -}; node_82(){ required 48 42 55; }; node_83(){ required 48 42 33 21; } -node_84(){ required 48 42 44 21; }; node_85(){ required 48 42 45 21; } -node_86(){ required 48 46; }; node_87(){ optional 69; }; node_88(){ -required 48 24 87; }; node_89(){ -either 53 56 57 58 59 63 65 66 67 70 71 72 74 75 78 81 82 83 84 85 86 88; } -node_90(){ required 89; }; cat <<<' docopt_exit() { -[[ -n $1 ]] && printf "%s\n" "$1" >&2; printf "%s\n" "${DOC:40:1091}" >&2 -exit 1; }'; unset var___stack var___env var___help var___version var___server \ +value _port_ a; }; node_24(){ _command app; }; node_25(){ _command new; } +node_26(){ _command list; }; node_27(){ _command ls; }; node_28(){ +_command deploy; }; node_29(){ _command undeploy; }; node_30(){ _command config +}; node_31(){ _command delete; }; node_32(){ _command rm; }; node_33(){ +_command logs; }; node_34(){ _command multilogs; }; node_35(){ _command cp; } +node_36(){ _command run; }; node_37(){ _command secret; }; node_38(){ +_command auto; }; node_39(){ _command generate; }; node_40(){ _command insert; } +node_41(){ _command server; }; node_42(){ _command add; }; node_43(){ +_command use; }; node_44(){ _command init; }; node_45(){ _command upgrade; } +node_46(){ optional 0 1 2 3; }; node_47(){ optional 46; }; node_48(){ optional 4 +}; node_49(){ optional 5; }; node_50(){ optional 6; }; node_51(){ optional 7; } +node_52(){ required 47 24 25 48 49 50 51 11; }; node_53(){ either 26 27; } +node_54(){ required 53; }; node_55(){ required 47 24 54; }; node_56(){ +required 47 24 12 28; }; node_57(){ required 47 24 12 29; }; node_58(){ +required 47 24 12 30; }; node_59(){ either 31 32; }; node_60(){ required 59; } +node_61(){ optional 8; }; node_62(){ required 47 24 12 60 61; }; node_63(){ +optional 13; }; node_64(){ required 47 24 12 33 63; }; node_65(){ +required 47 24 12 34; }; node_66(){ required 47 24 12 35 14 15; }; node_67(){ +optional 9; }; node_68(){ oneormore 16; }; node_69(){ +required 47 24 12 36 67 13 68; }; node_70(){ required 47 24 12 36 13 68; } +node_71(){ required 47 24 12 37 38; }; node_72(){ optional 19; }; node_73(){ +required 47 24 12 37 39 17 18 72 50; }; node_74(){ +required 47 24 12 37 40 17 18 20 50; }; node_75(){ either 17 10; }; node_76(){ +required 75; }; node_77(){ required 47 24 12 37 60 76 50 61; }; node_78(){ +optional 22; }; node_79(){ optional 23; }; node_80(){ required 47 41 42 21 78 79 +}; node_81(){ required 47 41 54; }; node_82(){ required 47 41 32 21; } +node_83(){ required 47 41 43 21; }; node_84(){ required 47 41 44 21; } +node_85(){ required 47 45; }; node_86(){ +either 52 55 56 57 58 62 64 65 66 69 70 71 73 74 77 80 81 82 83 84 85; } +node_87(){ required 86; }; cat <<<' docopt_exit() { +[[ -n $1 ]] && printf "%s\n" "$1" >&2; printf "%s\n" "${DOC:40:1052}" >&2 +exit 1; }'; unset var___env var___version var___help var___stack var___server \ var___domain var___pass var___auto var___force var___user var___all var__app_ \ var__domain_ var__service_ var__src_ var__dst_ var__args_ var__secret_ \ -var__version_ var__cmd_ var__data_ var__host_ var__user_ var__port_ \ -var__command_ var_app var_new var_list var_ls var_deploy var_undeploy \ -var_config var_delete var_rm var_logs var_multilogs var_cp var_run var_secret \ -var_auto var_generate var_insert var_server var_add var_use var_init var_upgrade -parse 90 "$@"; local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__stack" \ -"${prefix}__env" "${prefix}__help" "${prefix}__version" "${prefix}__server" \ -"${prefix}__domain" "${prefix}__pass" "${prefix}__auto" "${prefix}__force" \ -"${prefix}__user" "${prefix}__all" "${prefix}_app_" "${prefix}_domain_" \ -"${prefix}_service_" "${prefix}_src_" "${prefix}_dst_" "${prefix}_args_" \ -"${prefix}_secret_" "${prefix}_version_" "${prefix}_cmd_" "${prefix}_data_" \ -"${prefix}_host_" "${prefix}_user_" "${prefix}_port_" "${prefix}_command_" \ -"${prefix}app" "${prefix}new" "${prefix}list" "${prefix}ls" "${prefix}deploy" \ -"${prefix}undeploy" "${prefix}config" "${prefix}delete" "${prefix}rm" \ -"${prefix}logs" "${prefix}multilogs" "${prefix}cp" "${prefix}run" \ -"${prefix}secret" "${prefix}auto" "${prefix}generate" "${prefix}insert" \ -"${prefix}server" "${prefix}add" "${prefix}use" "${prefix}init" \ -"${prefix}upgrade"; eval "${prefix}"'__stack=${var___stack:-}' +var__version_ var__cmd_ var__data_ var__host_ var__user_ var__port_ var_app \ +var_new var_list var_ls var_deploy var_undeploy var_config var_delete var_rm \ +var_logs var_multilogs var_cp var_run var_secret var_auto var_generate \ +var_insert var_server var_add var_use var_init var_upgrade; parse 87 "$@" +local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__env" "${prefix}__version" \ +"${prefix}__help" "${prefix}__stack" "${prefix}__server" "${prefix}__domain" \ +"${prefix}__pass" "${prefix}__auto" "${prefix}__force" "${prefix}__user" \ +"${prefix}__all" "${prefix}_app_" "${prefix}_domain_" "${prefix}_service_" \ +"${prefix}_src_" "${prefix}_dst_" "${prefix}_args_" "${prefix}_secret_" \ +"${prefix}_version_" "${prefix}_cmd_" "${prefix}_data_" "${prefix}_host_" \ +"${prefix}_user_" "${prefix}_port_" "${prefix}app" "${prefix}new" \ +"${prefix}list" "${prefix}ls" "${prefix}deploy" "${prefix}undeploy" \ +"${prefix}config" "${prefix}delete" "${prefix}rm" "${prefix}logs" \ +"${prefix}multilogs" "${prefix}cp" "${prefix}run" "${prefix}secret" \ +"${prefix}auto" "${prefix}generate" "${prefix}insert" "${prefix}server" \ +"${prefix}add" "${prefix}use" "${prefix}init" "${prefix}upgrade" eval "${prefix}"'__env=${var___env:-}' -eval "${prefix}"'__help=${var___help:-false}' eval "${prefix}"'__version=${var___version:-false}' +eval "${prefix}"'__help=${var___help:-false}' +eval "${prefix}"'__stack=${var___stack:-}' eval "${prefix}"'__server=${var___server:-}' eval "${prefix}"'__domain=${var___domain:-}' eval "${prefix}"'__pass=${var___pass:-false}' @@ -229,7 +227,6 @@ eval "${prefix}"'_cmd_=${var__cmd_:-}'; eval "${prefix}"'_data_=${var__data_:-}' eval "${prefix}"'_host_=${var__host_:-}' eval "${prefix}"'_user_=${var__user_:-}' eval "${prefix}"'_port_=${var__port_:-}' -eval "${prefix}"'_command_=${var__command_:-}' eval "${prefix}"'app=${var_app:-false}'; eval "${prefix}"'new=${var_new:-false}' eval "${prefix}"'list=${var_list:-false}'; eval "${prefix}"'ls=${var_ls:-false}' eval "${prefix}"'deploy=${var_deploy:-false}' @@ -248,18 +245,18 @@ eval "${prefix}"'add=${var_add:-false}'; eval "${prefix}"'use=${var_use:-false}' eval "${prefix}"'init=${var_init:-false}' eval "${prefix}"'upgrade=${var_upgrade:-false}'; local docopt_i=1 [[ $BASH_VERSION =~ ^4.3 ]] && docopt_i=2; for ((;docopt_i>0;docopt_i--)); do -declare -p "${prefix}__stack" "${prefix}__env" "${prefix}__help" \ -"${prefix}__version" "${prefix}__server" "${prefix}__domain" "${prefix}__pass" \ +declare -p "${prefix}__env" "${prefix}__version" "${prefix}__help" \ +"${prefix}__stack" "${prefix}__server" "${prefix}__domain" "${prefix}__pass" \ "${prefix}__auto" "${prefix}__force" "${prefix}__user" "${prefix}__all" \ "${prefix}_app_" "${prefix}_domain_" "${prefix}_service_" "${prefix}_src_" \ "${prefix}_dst_" "${prefix}_args_" "${prefix}_secret_" "${prefix}_version_" \ "${prefix}_cmd_" "${prefix}_data_" "${prefix}_host_" "${prefix}_user_" \ -"${prefix}_port_" "${prefix}_command_" "${prefix}app" "${prefix}new" \ -"${prefix}list" "${prefix}ls" "${prefix}deploy" "${prefix}undeploy" \ -"${prefix}config" "${prefix}delete" "${prefix}rm" "${prefix}logs" \ -"${prefix}multilogs" "${prefix}cp" "${prefix}run" "${prefix}secret" \ -"${prefix}auto" "${prefix}generate" "${prefix}insert" "${prefix}server" \ -"${prefix}add" "${prefix}use" "${prefix}init" "${prefix}upgrade"; done; } +"${prefix}_port_" "${prefix}app" "${prefix}new" "${prefix}list" "${prefix}ls" \ +"${prefix}deploy" "${prefix}undeploy" "${prefix}config" "${prefix}delete" \ +"${prefix}rm" "${prefix}logs" "${prefix}multilogs" "${prefix}cp" \ +"${prefix}run" "${prefix}secret" "${prefix}auto" "${prefix}generate" \ +"${prefix}insert" "${prefix}server" "${prefix}add" "${prefix}use" \ +"${prefix}init" "${prefix}upgrade"; done; } # docopt parser above, complete command for generating this parser is `docopt.sh abra` PROGRAM_NAME=$(basename "$0")