Skip to content

Commit

Permalink
fix: deploy alias
Browse files Browse the repository at this point in the history
  • Loading branch information
raaymax committed Oct 21, 2024
1 parent 5b0d77a commit a318f2f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
20 changes: 2 additions & 18 deletions src/writer/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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):
Expand Down
7 changes: 1 addition & 6 deletions src/writer/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))

Expand Down

0 comments on commit a318f2f

Please sign in to comment.