From a2269d859b576dbd1d0face700c790a0e5a637c5 Mon Sep 17 00:00:00 2001 From: Lucas Nestler <39779310+ClashLuke@users.noreply.github.com> Date: Mon, 18 Apr 2022 02:52:50 +0200 Subject: [PATCH] fix(cli): use click 8.x's interface --- tpunicorn/program.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tpunicorn/program.py b/tpunicorn/program.py index b03f82f..4fdefef 100644 --- a/tpunicorn/program.py +++ b/tpunicorn/program.py @@ -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): @@ -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." @@ -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) @@ -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) @@ -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) @@ -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="", @@ -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="", @@ -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) @@ -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)