Merge pull request 'Remove abra server use' (#52) from server-use-remove into main

Reviewed-on: coop-cloud/abra#52
This commit is contained in:
decentral1se 2020-12-29 14:26:39 +01:00
commit 4339c91cf3

95
abra
View File

@ -32,7 +32,6 @@ Usage:
abra [options] server add <host> [<user>] [<port>] abra [options] server add <host> [<user>] [<port>]
abra [options] server (list|ls) abra [options] server (list|ls)
abra [options] server <host> rm abra [options] server <host> rm
abra [options] server <host> use
abra [options] server <host> init abra [options] server <host> init
abra [options] server <host> apps [--status] abra [options] server <host> apps [--status]
abra [options] upgrade abra [options] upgrade
@ -145,13 +144,13 @@ 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() { return 1; }; stdout() { printf -- "cat <<'EOM'\n%s\nEOM\n" "$1"; }; stderr() {
printf -- "cat <<'EOM' >&2\n%s\nEOM\n" "$1"; }; error() { printf -- "cat <<'EOM' >&2\n%s\nEOM\n" "$1"; }; error() {
[[ -n $1 ]] && stderr "$1"; stderr "$usage"; _return 1; }; _return() { [[ -n $1 ]] && stderr "$1"; stderr "$usage"; _return 1; }; _return() {
printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:1594} printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:1559}
usage=${DOC:40:1286}; digest=1c8e5 usage=${DOC:40:1251}; digest=4b15c
shorts=(-s -e -v -h '' '' '' '' '' '' '' '' '' '') shorts=(-e -v -h -s '' '' '' '' '' '' '' '' '' '')
longs=(--stack --env --version --help --server --domain --pass --auto --status --skip-check --force --no-tty --user --all) longs=(--env --version --help --stack --server --domain --pass --auto --status --skip-check --force --no-tty --user --all)
argcounts=(1 1 0 0 1 1 0 0 0 0 0 0 1 0); node_0(){ value __stack 0; }; node_1(){ argcounts=(1 0 0 1 1 1 0 0 0 0 0 0 1 0); node_0(){ value __env 0; }; node_1(){
value __env 1; }; node_2(){ switch __version 2; }; node_3(){ switch __help 3; } 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(){ }; node_4(){ value __server 4; }; node_5(){ value __domain 5; }; node_6(){
switch __pass 6; }; node_7(){ switch __auto 7; }; node_8(){ switch __status 8; } switch __pass 6; }; node_7(){ switch __auto 7; }; node_8(){ switch __status 8; }
node_9(){ switch __skip_check 9; }; node_10(){ switch __force 10; }; node_11(){ node_9(){ switch __skip_check 9; }; node_10(){ switch __force 10; }; node_11(){
switch __no_tty 11; }; node_12(){ value __user 12; }; node_13(){ switch __all 13 switch __no_tty 11; }; node_12(){ value __user 12; }; node_13(){ switch __all 13
@ -169,43 +168,42 @@ _command cp; }; node_40(){ _command check; }; node_41(){ _command ps; }
node_42(){ _command run; }; node_43(){ _command secret; }; node_44(){ node_42(){ _command run; }; node_43(){ _command secret; }; node_44(){
_command auto; }; node_45(){ _command generate; }; node_46(){ _command insert; } _command auto; }; node_45(){ _command generate; }; node_46(){ _command insert; }
node_47(){ _command server; }; node_48(){ _command add; }; node_49(){ node_47(){ _command server; }; node_48(){ _command add; }; node_49(){
_command use; }; node_50(){ _command init; }; node_51(){ _command apps; } _command init; }; node_50(){ _command apps; }; node_51(){ _command upgrade; }
node_52(){ _command upgrade; }; node_53(){ optional 0 1 2 3; }; node_54(){ node_52(){ optional 0 1 2 3; }; node_53(){ optional 52; }; node_54(){ optional 4
optional 53; }; node_55(){ optional 4; }; node_56(){ optional 5; }; node_57(){ }; node_55(){ optional 5; }; node_56(){ optional 6; }; node_57(){ optional 7; }
optional 6; }; node_58(){ optional 7; }; node_59(){ node_58(){ required 53 28 29 54 55 56 57 14; }; node_59(){ either 30 31; }
required 54 28 29 55 56 57 58 14; }; node_60(){ either 30 31; }; node_61(){ node_60(){ required 59; }; node_61(){ optional 8; }; node_62(){
required 60; }; node_62(){ optional 8; }; node_63(){ required 54 28 61 62 55; } required 53 28 60 61 54; }; node_63(){ optional 9; }; node_64(){
node_64(){ optional 9; }; node_65(){ required 54 28 15 32 64; }; node_66(){ required 53 28 15 32 63; }; node_65(){ required 53 28 15 33; }; node_66(){
required 54 28 15 33; }; node_67(){ required 54 28 15 34; }; node_68(){ required 53 28 15 34; }; node_67(){ either 35 36; }; node_68(){ required 67; }
either 35 36; }; node_69(){ required 68; }; node_70(){ optional 10; } node_69(){ optional 10; }; node_70(){ required 53 28 15 68 69; }; node_71(){
node_71(){ required 54 28 15 69 70; }; node_72(){ optional 16; }; node_73(){ optional 16; }; node_72(){ required 53 28 15 37 71; }; node_73(){
required 54 28 15 37 72; }; node_74(){ required 54 28 15 38; }; node_75(){ required 53 28 15 38; }; node_74(){ required 53 28 15 39 17 18; }; node_75(){
required 54 28 15 39 17 18; }; node_76(){ required 54 28 15 40; }; node_77(){ required 53 28 15 40; }; node_76(){ required 53 28 15 41; }; node_77(){
required 54 28 15 41; }; node_78(){ optional 11; }; node_79(){ optional 12; } optional 11; }; node_78(){ optional 12; }; node_79(){ oneormore 19; }
node_80(){ oneormore 19; }; node_81(){ required 54 28 15 42 78 79 16 80; } node_80(){ required 53 28 15 42 77 78 16 79; }; node_81(){
node_82(){ required 54 28 15 42 16 80; }; node_83(){ required 54 28 15 43 44 57 required 53 28 15 42 16 79; }; node_82(){ required 53 28 15 43 44 56; }
}; node_84(){ optional 22; }; node_85(){ required 54 28 15 43 45 20 21 84 57; } node_83(){ optional 22; }; node_84(){ required 53 28 15 43 45 20 21 83 56; }
node_86(){ required 54 28 15 43 46 20 21 23 57; }; node_87(){ either 20 13; } node_85(){ required 53 28 15 43 46 20 21 23 56; }; node_86(){ either 20 13; }
node_88(){ required 87; }; node_89(){ required 54 28 15 43 69 88 57 70; } node_87(){ required 86; }; node_88(){ required 53 28 15 43 68 87 56 69; }
node_90(){ optional 80; }; node_91(){ required 54 28 15 24 90; }; node_92(){ node_89(){ optional 79; }; node_90(){ required 53 28 15 24 89; }; node_91(){
optional 26; }; node_93(){ optional 27; }; node_94(){ required 54 47 48 25 92 93 optional 26; }; node_92(){ optional 27; }; node_93(){ required 53 47 48 25 91 92
}; node_95(){ required 54 47 61; }; node_96(){ required 54 47 25 36; } }; node_94(){ required 53 47 60; }; node_95(){ required 53 47 25 36; }
node_97(){ required 54 47 25 49; }; node_98(){ required 54 47 25 50; } node_96(){ required 53 47 25 49; }; node_97(){ required 53 47 25 50 61; }
node_99(){ required 54 47 25 51 62; }; node_100(){ required 54 52; } node_98(){ required 53 51; }; node_99(){
node_101(){ either 58 62 64 65 66 70 72 73 74 75 76 80 81 82 84 85 88 90 93 94 95 96 97 98
either 59 63 65 66 67 71 73 74 75 76 77 81 82 83 85 86 89 91 94 95 96 97 98 99 100 }; node_100(){ required 99; }; cat <<<' docopt_exit() {
}; node_102(){ required 101; }; cat <<<' docopt_exit() { [[ -n $1 ]] && printf "%s\n" "$1" >&2; printf "%s\n" "${DOC:40:1251}" >&2
[[ -n $1 ]] && printf "%s\n" "$1" >&2; printf "%s\n" "${DOC:40:1286}" >&2 exit 1; }'; unset var___env var___version var___help var___stack var___server \
exit 1; }'; unset var___stack var___env var___version var___help var___server \
var___domain var___pass var___auto var___status var___skip_check var___force \ var___domain var___pass var___auto var___status var___skip_check var___force \
var___no_tty var___user var___all var__app_ var__domain_ var__service_ \ var___no_tty 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__src_ var__dst_ var__args_ var__secret_ var__version_ var__cmd_ var__data_ \
var__command_ var__host_ var__user_ var__port_ var_app var_new var_list var_ls \ var__command_ 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_deploy var_undeploy var_config var_delete var_rm var_logs var_multilogs \
var_cp var_check var_ps var_run var_secret var_auto var_generate var_insert \ var_cp var_check var_ps var_run var_secret var_auto var_generate var_insert \
var_server var_add var_use var_init var_apps var_upgrade; parse 102 "$@" var_server var_add var_init var_apps var_upgrade; parse 100 "$@"
local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__stack" "${prefix}__env" \ local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__env" "${prefix}__version" \
"${prefix}__version" "${prefix}__help" "${prefix}__server" "${prefix}__domain" \ "${prefix}__help" "${prefix}__stack" "${prefix}__server" "${prefix}__domain" \
"${prefix}__pass" "${prefix}__auto" "${prefix}__status" \ "${prefix}__pass" "${prefix}__auto" "${prefix}__status" \
"${prefix}__skip_check" "${prefix}__force" "${prefix}__no_tty" \ "${prefix}__skip_check" "${prefix}__force" "${prefix}__no_tty" \
"${prefix}__user" "${prefix}__all" "${prefix}_app_" "${prefix}_domain_" \ "${prefix}__user" "${prefix}__all" "${prefix}_app_" "${prefix}_domain_" \
@ -217,11 +215,11 @@ local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__stack" "${prefix}__env" \
"${prefix}logs" "${prefix}multilogs" "${prefix}cp" "${prefix}check" \ "${prefix}logs" "${prefix}multilogs" "${prefix}cp" "${prefix}check" \
"${prefix}ps" "${prefix}run" "${prefix}secret" "${prefix}auto" \ "${prefix}ps" "${prefix}run" "${prefix}secret" "${prefix}auto" \
"${prefix}generate" "${prefix}insert" "${prefix}server" "${prefix}add" \ "${prefix}generate" "${prefix}insert" "${prefix}server" "${prefix}add" \
"${prefix}use" "${prefix}init" "${prefix}apps" "${prefix}upgrade" "${prefix}init" "${prefix}apps" "${prefix}upgrade"
eval "${prefix}"'__stack=${var___stack:-}'
eval "${prefix}"'__env=${var___env:-}' eval "${prefix}"'__env=${var___env:-}'
eval "${prefix}"'__version=${var___version:-false}' eval "${prefix}"'__version=${var___version:-false}'
eval "${prefix}"'__help=${var___help:-false}' eval "${prefix}"'__help=${var___help:-false}'
eval "${prefix}"'__stack=${var___stack:-}'
eval "${prefix}"'__server=${var___server:-}' eval "${prefix}"'__server=${var___server:-}'
eval "${prefix}"'__domain=${var___domain:-}' eval "${prefix}"'__domain=${var___domain:-}'
eval "${prefix}"'__pass=${var___pass:-false}' eval "${prefix}"'__pass=${var___pass:-false}'
@ -261,13 +259,13 @@ eval "${prefix}"'auto=${var_auto:-false}'
eval "${prefix}"'generate=${var_generate:-false}' eval "${prefix}"'generate=${var_generate:-false}'
eval "${prefix}"'insert=${var_insert:-false}' eval "${prefix}"'insert=${var_insert:-false}'
eval "${prefix}"'server=${var_server:-false}' eval "${prefix}"'server=${var_server:-false}'
eval "${prefix}"'add=${var_add:-false}'; eval "${prefix}"'use=${var_use:-false}' eval "${prefix}"'add=${var_add:-false}'
eval "${prefix}"'init=${var_init:-false}' eval "${prefix}"'init=${var_init:-false}'
eval "${prefix}"'apps=${var_apps:-false}' eval "${prefix}"'apps=${var_apps:-false}'
eval "${prefix}"'upgrade=${var_upgrade:-false}'; local docopt_i=1 eval "${prefix}"'upgrade=${var_upgrade:-false}'; local docopt_i=1
[[ $BASH_VERSION =~ ^4.3 ]] && docopt_i=2; for ((;docopt_i>0;docopt_i--)); do [[ $BASH_VERSION =~ ^4.3 ]] && docopt_i=2; for ((;docopt_i>0;docopt_i--)); do
declare -p "${prefix}__stack" "${prefix}__env" "${prefix}__version" \ declare -p "${prefix}__env" "${prefix}__version" "${prefix}__help" \
"${prefix}__help" "${prefix}__server" "${prefix}__domain" "${prefix}__pass" \ "${prefix}__stack" "${prefix}__server" "${prefix}__domain" "${prefix}__pass" \
"${prefix}__auto" "${prefix}__status" "${prefix}__skip_check" \ "${prefix}__auto" "${prefix}__status" "${prefix}__skip_check" \
"${prefix}__force" "${prefix}__no_tty" "${prefix}__user" "${prefix}__all" \ "${prefix}__force" "${prefix}__no_tty" "${prefix}__user" "${prefix}__all" \
"${prefix}_app_" "${prefix}_domain_" "${prefix}_service_" "${prefix}_src_" \ "${prefix}_app_" "${prefix}_domain_" "${prefix}_service_" "${prefix}_src_" \
@ -278,8 +276,8 @@ declare -p "${prefix}__stack" "${prefix}__env" "${prefix}__version" \
"${prefix}config" "${prefix}delete" "${prefix}rm" "${prefix}logs" \ "${prefix}config" "${prefix}delete" "${prefix}rm" "${prefix}logs" \
"${prefix}multilogs" "${prefix}cp" "${prefix}check" "${prefix}ps" \ "${prefix}multilogs" "${prefix}cp" "${prefix}check" "${prefix}ps" \
"${prefix}run" "${prefix}secret" "${prefix}auto" "${prefix}generate" \ "${prefix}run" "${prefix}secret" "${prefix}auto" "${prefix}generate" \
"${prefix}insert" "${prefix}server" "${prefix}add" "${prefix}use" \ "${prefix}insert" "${prefix}server" "${prefix}add" "${prefix}init" \
"${prefix}init" "${prefix}apps" "${prefix}upgrade"; done; } "${prefix}apps" "${prefix}upgrade"; done; }
# docopt parser above, complete command for generating this parser is `docopt.sh abra` # docopt parser above, complete command for generating this parser is `docopt.sh abra`
PROGRAM_NAME=$(basename "$0") PROGRAM_NAME=$(basename "$0")
@ -979,11 +977,6 @@ sub_server_delete() {
docker context rm "$abra__host_" docker context rm "$abra__host_"
} }
###### .. server <host> use
sub_server_use() {
docker context use "$abra__host_"
}
###### .. server <host> apps ###### .. server <host> apps
sub_server_apps() { sub_server_apps() {
abra___server="$abra__host_" abra___server="$abra__host_"