Rename abra context to abra server

This commit is contained in:
3wc 2020-10-23 05:02:39 +02:00
parent b7757b51b1
commit 16a09887e6

24
abra
View File

@ -165,7 +165,7 @@ sub_help() {
echo " --version Show program version" echo " --version Show program version"
echo "" echo ""
echo "Commands:" echo "Commands:"
echo " context manage remote swarm contexts" echo " server manage remote host"
echo " cp copy files to a container" echo " cp copy files to a container"
echo " deploy let 'em rip" echo " deploy let 'em rip"
echo " logs tail logs from a deployed service" echo " logs tail logs from a deployed service"
@ -391,23 +391,24 @@ sub_cp() {
###### Subcommand `context` ###### Subcommand `context`
sub_context_help() { sub_server_help() {
echo "Usage: $PROGRAM_NAME [global opts] context <subcommand> [sub opts]" echo "Usage: $PROGRAM_NAME [global opts] server <subcommand> [sub opts]"
echo "" echo ""
echo "Subcommands:" echo "Subcommands:"
echo " create HOST [USER] [PORT] set up remote Docker context" echo " add HOST [USER] [PORT] set up remote Docker context"
echo " rm HOST"
echo " use HOST activate remote Docker context" echo " use HOST activate remote Docker context"
echo " init HOST activate swarm mode" echo " init HOST activate swarm mode"
} }
sub_context_init() { sub_server_init() {
load_context load_context
docker swarm init || true docker swarm init || true
docker network create --driver=overlay proxy --scope swarm || true docker network create --driver=overlay proxy --scope swarm || true
} }
sub_context_create() { sub_server_add() {
HOST="$1" HOST="$1"
USERNAME="$2" USERNAME="$2"
PORT="$3" PORT="$3"
@ -424,15 +425,20 @@ sub_context_create() {
--docker "host=ssh://$USERNAME$HOST$PORT" --docker "host=ssh://$USERNAME$HOST$PORT"
} }
sub_context_use() { sub_server_rm() {
HOST="$1"
docker context rm "$HOST"
}
sub_server_use() {
docker context use "$1" docker context use "$1"
} }
sub_context() { sub_server() {
SUBCOMMAND2=$1 SUBCOMMAND2=$1
shift shift
# shellcheck disable=SC2068 # shellcheck disable=SC2068
parse_subcommand "$SUBCOMMAND2" "context" $@ parse_subcommand "$SUBCOMMAND2" "server" $@
} }