From 75da296222d0558138cc2d88516b8a7a7f331ef4 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Sat, 3 Jun 2023 17:28:56 -0600 Subject: [PATCH] Add new subcommands --- app/deployment.py | 64 ++++++++++++++++++++++++++++++++++++++++++++++ app/deployments.py | 21 --------------- cli.py | 2 ++ 3 files changed, 66 insertions(+), 21 deletions(-) create mode 100644 app/deployment.py delete mode 100644 app/deployments.py diff --git a/app/deployment.py b/app/deployment.py new file mode 100644 index 0000000..3c1f5f7 --- /dev/null +++ b/app/deployment.py @@ -0,0 +1,64 @@ +# Copyright © 2022, 2023 Cerc + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import click +import sys + + +@click.group() +@click.option("--dir", required=True, help="path to deployment directory") +@click.pass_context +def command(ctx): + print(f"Context: {ctx.parent.obj}") + # Check that --stack wasn't supplied + if ctx.parent.obj.stack: + print("Error: --stack can't be supplied with the deployment command") + sys.exit(1) + + +@command.command() +@click.pass_context +def up(ctx): + print(f"Context: {ctx.parent.obj}") + + +@command.command() +@click.pass_context +def down(ctx): + print(f"Context: {ctx.parent.obj}") + + +@command.command() +@click.pass_context +def ps(ctx): + print(f"Context: {ctx.parent.obj}") + + +@command.command() +@click.pass_context +def logs(ctx): + print(f"Context: {ctx.parent.obj}") + + +@command.command() +@click.pass_context +def task(ctx): + print(f"Context: {ctx.parent.obj}") + + +@command.command() +@click.pass_context +def status(ctx): + print(f"Context: {ctx.parent.obj}") diff --git a/app/deployments.py b/app/deployments.py deleted file mode 100644 index 7bab5ce..0000000 --- a/app/deployments.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright © 2022, 2023 Cerc - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. - -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -import click - - -@click.command() -def init(): - pass diff --git a/cli.py b/cli.py index b7d1978..e9a11d2 100644 --- a/cli.py +++ b/cli.py @@ -21,6 +21,7 @@ from app import build_containers from app import build_npms from app import deploy from app import version +from app import deployment CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) @@ -56,4 +57,5 @@ cli.add_command(build_containers.command, "build-containers") cli.add_command(build_npms.command, "build-npms") cli.add_command(deploy.command, "deploy") # deploy is an alias for deploy-system cli.add_command(deploy.command, "deploy-system") +cli.add_command(deployment.command, "deployment") cli.add_command(version.command, "version")