From a318f2fda79ead916a04b9e0aebdd654ca0bbfb8 Mon Sep 17 00:00:00 2001 From: Mateusz Russak Date: Mon, 21 Oct 2024 18:08:43 +0200 Subject: [PATCH] fix: deploy alias --- src/writer/command_line.py | 20 ++------------------ src/writer/deploy.py | 7 +------ 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/src/writer/command_line.py b/src/writer/command_line.py index e28e2e58b..1255f5240 100644 --- a/src/writer/command_line.py +++ b/src/writer/command_line.py @@ -7,7 +7,7 @@ import click import writer.serve -from writer.deploy import cloud, deploy_app +from writer.deploy import cloud, deploy CONTEXT_SETTINGS = {'help_option_names': ['-h', '--help']} @click.group( @@ -73,23 +73,7 @@ def hello(port: Optional[int], host: str, enable_remote_edit): enable_server_setup=False) -@main.command() -@click.option('--api-key', - default=lambda: os.environ.get("WRITER_API_KEY", None), - allow_from_autoenv=True, - show_envvar=True, - envvar='WRITER_API_KEY', - prompt="Enter your API key", - hide_input=True, help="Writer API key" -) -@click.option('--env', '-e', multiple=True, default=[], help="Environment to deploy the app to") -@click.option('--force', '-f', default=False, is_flag=True, help="Ignores warnings and overwrites the app") -@click.option('--verbose', '-v', default=False, is_flag=True, help="Enable verbose mode") -@click.argument('path') -def deploy(path, api_key, env, verbose, force): - """Deploy the app from PATH folder.""" - deploy_app(path, api_key, env, verbose, force) - +main.add_command(deploy, name="deploy") main.add_command(cloud) def create_app(app_path: str, template_name: Optional[str], overwrite=False): diff --git a/src/writer/deploy.py b/src/writer/deploy.py index 96803004c..b733134ef 100644 --- a/src/writer/deploy.py +++ b/src/writer/deploy.py @@ -30,18 +30,13 @@ def cloud(): prompt="Enter your API key", hide_input=True, help="Writer API key" ) -@click.option('--env', '-e', multiple=True, default=[], help="Environment to deploy the app to") +@click.option('--env', '-e', multiple=True, default=[], help="Environment variable to deploy the app to") @click.option('--force', '-f', default=False, is_flag=True, help="Ignores warnings and overwrites the app") @click.option('--verbose', '-v', default=False, is_flag=True, help="Enable verbose mode") @click.argument('path') def deploy(path, api_key, env, verbose, force): """Deploy the app from PATH folder.""" - deploy_app(path, api_key, env, verbose, force) - -def deploy_app(path, api_key, env, verbose, force): - """Deploy the app from PATH folder.""" - deploy_url = os.getenv("WRITER_DEPLOY_URL", "https://api.writer.com/v1/deployment/apps") sleep_interval = int(os.getenv("WRITER_DEPLOY_SLEEP_INTERVAL", '5'))