Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(cli): use click 8.x's interface #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions tpunicorn/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def complete_tpu_id(ctx, args, incomplete, zone=None, project=None):
return [tpunicorn.tpu.parse_tpu_id(tpu) for tpu in tpus]

# @cli.command()
# @click.argument('tpu', type=click.STRING, autocompletion=complete_tpu_id)
# @click.argument('tpu', type=click.STRING, shell_complete=complete_tpu_id)
# @tpu_zone_option()
# @click.option('-p', '--project', type=click.STRING, default=None)
# def create(tpu, zone, project):
Expand Down Expand Up @@ -193,7 +193,7 @@ def do_step(label=None, command=None, dry_run=False, delay_after=1.0, args=(), k
return result

@cli.command()
@click.argument('tpu', type=click.STRING, metavar="[TPU; default=\"0+\"]", default="0+", autocompletion=complete_tpu_id)
@click.argument('tpu', type=click.STRING, metavar="[TPU; default=\"0+\"]", default="0+", shell_complete=complete_tpu_id)
@tpu_zone_option()
@click.option('-v', '--version', type=click.STRING, metavar="[VERSION; default=\"v2-alpha\"]", default="v2-alpha",
help="By default, the TPU version is v2-alpha, which means it's created as a TPU VM."
Expand Down Expand Up @@ -272,7 +272,7 @@ def create(ctx, tpu, zone, version, accelerator_type, data_disk, async_, descrip


@cli.command()
@click.argument('tpu', type=click.STRING, autocompletion=complete_tpu_id)
@click.argument('tpu', type=click.STRING, shell_complete=complete_tpu_id)
@tpu_zone_option()
@click.option('-p', '--project', type=click.STRING, default=None)
@click.option('-y', '--yes', is_flag=True)
Expand All @@ -298,7 +298,7 @@ def delete(tpu, zone, project, yes, dry_run, async_):
create)

@cli.command()
@click.argument('tpu', type=click.STRING, autocompletion=complete_tpu_id)
@click.argument('tpu', type=click.STRING, shell_complete=complete_tpu_id)
@tpu_zone_option()
@click.option('-p', '--project', type=click.STRING, default=None)
@click.option('-y', '--yes', is_flag=True)
Expand All @@ -324,7 +324,7 @@ def stop(tpu, zone, project, yes, dry_run, async_):
start)

@cli.command()
@click.argument('tpu', type=click.STRING, autocompletion=complete_tpu_id)
@click.argument('tpu', type=click.STRING, shell_complete=complete_tpu_id)
@tpu_zone_option()
@click.option('-p', '--project', type=click.STRING, default=None)
@click.option('-y', '--yes', is_flag=True)
Expand All @@ -350,7 +350,7 @@ def start(tpu, zone, project, yes, dry_run, async_):
stop)

@cli.command()
@click.argument('tpu', type=click.STRING, autocompletion=complete_tpu_id)
@click.argument('tpu', type=click.STRING, shell_complete=complete_tpu_id)
@tpu_zone_option()
@click.option('-p', '--project', type=click.STRING, default=None)
@click.option('--version', type=click.STRING, metavar="<TF_VERSION>",
Expand Down Expand Up @@ -380,7 +380,7 @@ def wait():
'would be' if dry_run else 'is'))

@cli.command()
@click.argument('tpu', type=click.STRING, autocompletion=complete_tpu_id)
@click.argument('tpu', type=click.STRING, shell_complete=complete_tpu_id)
@tpu_zone_option()
@click.option('-p', '--project', type=click.STRING, default=None)
@click.option('--version', type=click.STRING, metavar="<TF_VERSION>",
Expand Down Expand Up @@ -440,7 +440,7 @@ def wait():


@cli.command()
@click.argument('tpu', type=click.STRING, autocompletion=complete_tpu_id)
@click.argument('tpu', type=click.STRING, shell_complete=complete_tpu_id)
@tpu_zone_option()
@click.option('-p', '--project', type=click.STRING, default=None)
@click.option('-y', '--yes', is_flag=True)
Expand All @@ -462,7 +462,7 @@ def ssh(tpu, zone, project, yes, dry_run, ssh_flag):


@cli.command()
@click.argument('tpu', type=click.STRING, autocompletion=complete_tpu_id)
@click.argument('tpu', type=click.STRING, shell_complete=complete_tpu_id)
@tpu_zone_option()
@click.option('-p', '--project', type=click.STRING, default=None)
@click.option('--dry-run', is_flag=True)
Expand Down