Commit 644ffda3 authored by Finn's avatar Finn
Browse files

Added cancel command to app.

parent 555d486f
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -153,6 +153,20 @@ def status(context, operation_name, json):
        click.echo(json_format.MessageToJson(operation))


@cli.command('cancel', short_help="Cancel an operation.")
@click.argument('operation-name', nargs=1, type=click.STRING, required=True)
@pass_context
def cancel(context, operation_name):
    clic.echo("Cancelling an operation...")
    stub = operations_pb2_grpc.OperationsStub(context.channel)

    request = operations_pb2.CancelOperationRequest(name=operation_name)

    stub.CancelOperation(request)

    click.echo("Operation cancelled: [{}]".format(request))


@cli.command('list', short_help="List operations.")
@click.option('--json', is_flag=True, show_default=True,
              help="Print operations list in JSON format.")