Implement remaining subcommands
This commit is contained in:
parent
b355566596
commit
de0018a9c7
@ -90,26 +90,7 @@ def down_operation(ctx, delete_volumes, extra_args_list):
|
|||||||
ctx.obj.docker.compose.down(timeout=timeout_arg, volumes=delete_volumes)
|
ctx.obj.docker.compose.down(timeout=timeout_arg, volumes=delete_volumes)
|
||||||
|
|
||||||
|
|
||||||
@command.command()
|
def ps_operation(ctx):
|
||||||
@click.argument('extra_args', nargs=-1) # help: command: up <service1> <service2>
|
|
||||||
@click.pass_context
|
|
||||||
def up(ctx, extra_args):
|
|
||||||
extra_args_list = list(extra_args) or None
|
|
||||||
up_operation(ctx, extra_args_list)
|
|
||||||
|
|
||||||
|
|
||||||
@command.command()
|
|
||||||
@click.option("--delete-volumes/--preserve-volumes", default=False, help="delete data volumes")
|
|
||||||
@click.argument('extra_args', nargs=-1) # help: command: down<service1> <service2>
|
|
||||||
@click.pass_context
|
|
||||||
def down(ctx, delete_volumes, extra_args):
|
|
||||||
extra_args_list = list(extra_args) or None
|
|
||||||
down_operation(ctx, delete_volumes, extra_args_list)
|
|
||||||
|
|
||||||
|
|
||||||
@command.command()
|
|
||||||
@click.pass_context
|
|
||||||
def ps(ctx):
|
|
||||||
global_context = ctx.parent.parent.obj
|
global_context = ctx.parent.parent.obj
|
||||||
if not global_context.dry_run:
|
if not global_context.dry_run:
|
||||||
if global_context.verbose:
|
if global_context.verbose:
|
||||||
@ -134,10 +115,7 @@ def ps(ctx):
|
|||||||
print("No containers running")
|
print("No containers running")
|
||||||
|
|
||||||
|
|
||||||
@command.command()
|
def port_operation(ctx, extra_args):
|
||||||
@click.argument('extra_args', nargs=-1) # help: command: port <service1> <service2>
|
|
||||||
@click.pass_context
|
|
||||||
def port(ctx, extra_args):
|
|
||||||
global_context = ctx.parent.parent.obj
|
global_context = ctx.parent.parent.obj
|
||||||
extra_args_list = list(extra_args) or None
|
extra_args_list = list(extra_args) or None
|
||||||
if not global_context.dry_run:
|
if not global_context.dry_run:
|
||||||
@ -152,10 +130,7 @@ def port(ctx, extra_args):
|
|||||||
print(f"{mapped_port_data[0]}:{mapped_port_data[1]}")
|
print(f"{mapped_port_data[0]}:{mapped_port_data[1]}")
|
||||||
|
|
||||||
|
|
||||||
@command.command()
|
def exec_operation(ctx, extra_args):
|
||||||
@click.argument('extra_args', nargs=-1) # help: command: exec <service> <command>
|
|
||||||
@click.pass_context
|
|
||||||
def exec(ctx, extra_args):
|
|
||||||
global_context = ctx.parent.parent.obj
|
global_context = ctx.parent.parent.obj
|
||||||
extra_args_list = list(extra_args) or None
|
extra_args_list = list(extra_args) or None
|
||||||
if not global_context.dry_run:
|
if not global_context.dry_run:
|
||||||
@ -173,10 +148,7 @@ def exec(ctx, extra_args):
|
|||||||
print(f"container command returned error exit status")
|
print(f"container command returned error exit status")
|
||||||
|
|
||||||
|
|
||||||
@command.command()
|
def logs_operation(ctx, extra_args):
|
||||||
@click.argument('extra_args', nargs=-1) # help: command: logs <service1> <service2>
|
|
||||||
@click.pass_context
|
|
||||||
def logs(ctx, extra_args):
|
|
||||||
global_context = ctx.parent.parent.obj
|
global_context = ctx.parent.parent.obj
|
||||||
extra_args_list = list(extra_args) or None
|
extra_args_list = list(extra_args) or None
|
||||||
if not global_context.dry_run:
|
if not global_context.dry_run:
|
||||||
@ -186,6 +158,50 @@ def logs(ctx, extra_args):
|
|||||||
print(logs_output)
|
print(logs_output)
|
||||||
|
|
||||||
|
|
||||||
|
@command.command()
|
||||||
|
@click.argument('extra_args', nargs=-1) # help: command: up <service1> <service2>
|
||||||
|
@click.pass_context
|
||||||
|
def up(ctx, extra_args):
|
||||||
|
extra_args_list = list(extra_args) or None
|
||||||
|
up_operation(ctx, extra_args_list)
|
||||||
|
|
||||||
|
|
||||||
|
@command.command()
|
||||||
|
@click.option("--delete-volumes/--preserve-volumes", default=False, help="delete data volumes")
|
||||||
|
@click.argument('extra_args', nargs=-1) # help: command: down<service1> <service2>
|
||||||
|
@click.pass_context
|
||||||
|
def down(ctx, delete_volumes, extra_args):
|
||||||
|
extra_args_list = list(extra_args) or None
|
||||||
|
down_operation(ctx, delete_volumes, extra_args_list)
|
||||||
|
|
||||||
|
|
||||||
|
@command.command()
|
||||||
|
@click.pass_context
|
||||||
|
def ps(ctx):
|
||||||
|
ps_operation(ctx)
|
||||||
|
|
||||||
|
|
||||||
|
@command.command()
|
||||||
|
@click.argument('extra_args', nargs=-1) # help: command: port <service1> <service2>
|
||||||
|
@click.pass_context
|
||||||
|
def port(ctx, extra_args):
|
||||||
|
port_operation(ctx, extra_args)
|
||||||
|
|
||||||
|
|
||||||
|
@command.command()
|
||||||
|
@click.argument('extra_args', nargs=-1) # help: command: exec <service> <command>
|
||||||
|
@click.pass_context
|
||||||
|
def exec(ctx, extra_args):
|
||||||
|
exec_operation(ctx, extra_args)
|
||||||
|
|
||||||
|
|
||||||
|
@command.command()
|
||||||
|
@click.argument('extra_args', nargs=-1) # help: command: logs <service1> <service2>
|
||||||
|
@click.pass_context
|
||||||
|
def logs(ctx, extra_args):
|
||||||
|
logs_operation(ctx, extra_args)
|
||||||
|
|
||||||
|
|
||||||
def get_stack_status(ctx, stack):
|
def get_stack_status(ctx, stack):
|
||||||
|
|
||||||
ctx_copy = copy.copy(ctx)
|
ctx_copy = copy.copy(ctx)
|
||||||
|
@ -17,7 +17,7 @@ import click
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import sys
|
import sys
|
||||||
from .deploy import up_operation, down_operation, create_deploy_context
|
from .deploy import up_operation, down_operation, ps_operation, port_operation, exec_operation, logs_operation, create_deploy_context
|
||||||
from .util import global_options
|
from .util import global_options
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@ -70,7 +70,7 @@ def down(ctx, extra_args):
|
|||||||
@command.command()
|
@command.command()
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def ps(ctx):
|
def ps(ctx):
|
||||||
print(f"Context: {ctx.parent.obj}")
|
ps_operation(ctx)
|
||||||
|
|
||||||
|
|
||||||
@command.command()
|
@command.command()
|
||||||
@ -79,6 +79,27 @@ def logs(ctx):
|
|||||||
print(f"Context: {ctx.parent.obj}")
|
print(f"Context: {ctx.parent.obj}")
|
||||||
|
|
||||||
|
|
||||||
|
@command.command()
|
||||||
|
@click.argument('extra_args', nargs=-1) # help: command: port <service1> <service2>
|
||||||
|
@click.pass_context
|
||||||
|
def port(ctx, extra_args):
|
||||||
|
port_operation(ctx, extra_args)
|
||||||
|
|
||||||
|
|
||||||
|
@command.command()
|
||||||
|
@click.argument('extra_args', nargs=-1) # help: command: exec <service> <command>
|
||||||
|
@click.pass_context
|
||||||
|
def exec(ctx, extra_args):
|
||||||
|
exec_operation(ctx, extra_args)
|
||||||
|
|
||||||
|
|
||||||
|
@command.command()
|
||||||
|
@click.argument('extra_args', nargs=-1) # help: command: logs <service1> <service2>
|
||||||
|
@click.pass_context
|
||||||
|
def logs(ctx, extra_args):
|
||||||
|
logs_operation(ctx, extra_args)
|
||||||
|
|
||||||
|
|
||||||
@command.command()
|
@command.command()
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def task(ctx):
|
def task(ctx):
|
||||||
|
Loading…
Reference in New Issue
Block a user