Merge pull request '<app> -> <type>' (#53) from app-goes-to-type into main

Reviewed-on: coop-cloud/abra#53
This commit is contained in:
decentral1se 2020-12-29 15:03:43 +01:00
commit 33315f6b43

54
abra
View File

@ -11,7 +11,7 @@ DOC="
The cooperative cloud utility belt 🎩🐇 The cooperative cloud utility belt 🎩🐇
Usage: Usage:
abra [options] app new [--server=<server>] [--domain=<domain>] [--pass] [--auto] <app> abra [options] app new [--server=<server>] [--domain=<domain>] [--pass] [--auto] <type>
abra [options] app (list|ls) [--status] [--server=<server>] abra [options] app (list|ls) [--status] [--server=<server>]
abra [options] app <domain> deploy [--skip-check] abra [options] app <domain> deploy [--skip-check]
abra [options] app <domain> undeploy abra [options] app <domain> undeploy
@ -144,17 +144,17 @@ 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:1559} printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:1560}
usage=${DOC:40:1251}; digest=4b15c usage=${DOC:40:1252}; digest=30845
shorts=(-e -v -h -s '' '' '' '' '' '' '' '' '' '') shorts=(-s -v -e -h '' '' '' '' '' '' '' '' '' '')
longs=(--env --version --help --stack --server --domain --pass --auto --status --skip-check --force --no-tty --user --all) longs=(--stack --version --env --help --server --domain --pass --auto --status --skip-check --force --no-tty --user --all)
argcounts=(1 0 0 1 1 1 0 0 0 0 0 0 1 0); node_0(){ value __env 0; }; node_1(){ argcounts=(1 0 1 0 1 1 0 0 0 0 0 0 1 0); node_0(){ value __stack 0; }; node_1(){
switch __version 1; }; node_2(){ switch __help 2; }; node_3(){ value __stack 3 switch __version 1; }; node_2(){ value __env 2; }; node_3(){ switch __help 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
}; node_14(){ value _app_ a; }; node_15(){ value _domain_ a; }; node_16(){ }; node_14(){ value _type_ a; }; node_15(){ value _domain_ a; }; node_16(){
value _service_ a; }; node_17(){ value _src_ a; }; node_18(){ value _dst_ a; } value _service_ a; }; node_17(){ value _src_ a; }; node_18(){ value _dst_ a; }
node_19(){ value _args_ a true; }; node_20(){ value _secret_ a; }; node_21(){ node_19(){ value _args_ a true; }; node_20(){ value _secret_ a; }; node_21(){
value _version_ a; }; node_22(){ value _cmd_ a; }; node_23(){ value _data_ a; } value _version_ a; }; node_22(){ value _cmd_ a; }; node_23(){ value _data_ a; }
@ -193,20 +193,20 @@ node_96(){ required 53 47 25 49; }; node_97(){ required 53 47 25 50 61; }
node_98(){ required 53 51; }; node_99(){ node_98(){ required 53 51; }; node_99(){
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 58 62 64 65 66 70 72 73 74 75 76 80 81 82 84 85 88 90 93 94 95 96 97 98
}; node_100(){ required 99; }; cat <<<' docopt_exit() { }; node_100(){ required 99; }; 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:1252}" >&2
exit 1; }'; unset var___env var___version var___help var___stack var___server \ exit 1; }'; unset var___stack var___version var___env 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__type_ 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_init var_apps var_upgrade; parse 100 "$@" var_server var_add var_init var_apps var_upgrade; parse 100 "$@"
local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__env" "${prefix}__version" \ local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__stack" \
"${prefix}__help" "${prefix}__stack" "${prefix}__server" "${prefix}__domain" \ "${prefix}__version" "${prefix}__env" "${prefix}__help" "${prefix}__server" \
"${prefix}__pass" "${prefix}__auto" "${prefix}__status" \ "${prefix}__domain" "${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}_type_" "${prefix}_domain_" \
"${prefix}_service_" "${prefix}_src_" "${prefix}_dst_" "${prefix}_args_" \ "${prefix}_service_" "${prefix}_src_" "${prefix}_dst_" "${prefix}_args_" \
"${prefix}_secret_" "${prefix}_version_" "${prefix}_cmd_" "${prefix}_data_" \ "${prefix}_secret_" "${prefix}_version_" "${prefix}_cmd_" "${prefix}_data_" \
"${prefix}_command_" "${prefix}_host_" "${prefix}_user_" "${prefix}_port_" \ "${prefix}_command_" "${prefix}_host_" "${prefix}_user_" "${prefix}_port_" \
@ -216,10 +216,10 @@ local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__env" "${prefix}__version" \
"${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}init" "${prefix}apps" "${prefix}upgrade" "${prefix}init" "${prefix}apps" "${prefix}upgrade"
eval "${prefix}"'__env=${var___env:-}'
eval "${prefix}"'__version=${var___version:-false}'
eval "${prefix}"'__help=${var___help:-false}'
eval "${prefix}"'__stack=${var___stack:-}' eval "${prefix}"'__stack=${var___stack:-}'
eval "${prefix}"'__version=${var___version:-false}'
eval "${prefix}"'__env=${var___env:-}'
eval "${prefix}"'__help=${var___help:-false}'
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}'
@ -230,7 +230,7 @@ eval "${prefix}"'__force=${var___force:-false}'
eval "${prefix}"'__no_tty=${var___no_tty:-false}' eval "${prefix}"'__no_tty=${var___no_tty:-false}'
eval "${prefix}"'__user=${var___user:-}' eval "${prefix}"'__user=${var___user:-}'
eval "${prefix}"'__all=${var___all:-false}' eval "${prefix}"'__all=${var___all:-false}'
eval "${prefix}"'_app_=${var__app_:-}' eval "${prefix}"'_type_=${var__type_:-}'
eval "${prefix}"'_domain_=${var__domain_:-}' eval "${prefix}"'_domain_=${var__domain_:-}'
eval "${prefix}"'_service_=${var__service_:-}' eval "${prefix}"'_service_=${var__service_:-}'
eval "${prefix}"'_src_=${var__src_:-}'; eval "${prefix}"'_dst_=${var__dst_:-}' eval "${prefix}"'_src_=${var__src_:-}'; eval "${prefix}"'_dst_=${var__dst_:-}'
@ -264,11 +264,11 @@ 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}__env" "${prefix}__version" "${prefix}__help" \ declare -p "${prefix}__stack" "${prefix}__version" "${prefix}__env" \
"${prefix}__stack" "${prefix}__server" "${prefix}__domain" "${prefix}__pass" \ "${prefix}__help" "${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}_type_" "${prefix}_domain_" "${prefix}_service_" "${prefix}_src_" \
"${prefix}_dst_" "${prefix}_args_" "${prefix}_secret_" "${prefix}_version_" \ "${prefix}_dst_" "${prefix}_args_" "${prefix}_secret_" "${prefix}_version_" \
"${prefix}_cmd_" "${prefix}_data_" "${prefix}_command_" "${prefix}_host_" \ "${prefix}_cmd_" "${prefix}_data_" "${prefix}_command_" "${prefix}_host_" \
"${prefix}_user_" "${prefix}_port_" "${prefix}app" "${prefix}new" \ "${prefix}_user_" "${prefix}_port_" "${prefix}app" "${prefix}new" \
@ -532,7 +532,11 @@ sub_app_new (){
require_abra_dir require_abra_dir
get_servers get_servers
APP=$abra__app_ # Note(decentral1se): we are overloading the use of the word "app" on this
# the interface and therefore try to use the word "type" to refer to "a type
# of app" vs. "an instance of an app"
APP=$abra__type_
SERVER=$abra___server SERVER=$abra___server
DOMAIN=$abra___domain DOMAIN=$abra___domain
@ -1019,7 +1023,7 @@ abra() {
# the place to handle the dynamically-defined vars # the place to handle the dynamically-defined vars
declare abra___stack abra___env abra__command_ abra__args_ \ declare abra___stack abra___env abra__command_ abra__args_ \
abra__secret_ abra__version_ abra__data_ abra___user abra__host_ \ abra__secret_ abra__version_ abra__data_ abra___user abra__host_ \
abra__app_ abra__port_ abra__user_ abra__service_ abra__src_ abra__dst_ \ abra__type_ abra__port_ abra__user_ abra__service_ abra__src_ abra__dst_ \
abra__domain_ abra___server abra___domain abra___force abra___pass \ abra__domain_ abra___server abra___domain abra___force abra___pass \
abra___auto abra___status abra___no_tty abra___skip_check abra___auto abra___status abra___no_tty abra___skip_check