From cc4f9598291e629798854bc18daf210ed81a566c Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Tue, 23 Jun 2020 23:34:44 -0700 Subject: [PATCH] Add `--print-location` for BentoML get command (#825) * add print_location flag * add python like jq interp option * fix test import and linting issues * fix typo lmao * linter * fix more linting issues and address review comments * remove jq-like parsing stuff --- bentoml/cli/bento.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bentoml/cli/bento.py b/bentoml/cli/bento.py index f80422e9ebf..2fe27cc7f98 100644 --- a/bentoml/cli/bento.py +++ b/bentoml/cli/bento.py @@ -92,10 +92,11 @@ def add_bento_sub_command(cli): '--limit', type=click.INT, help='Limit how many resources will be retrieved' ) @click.option('--ascending-order', is_flag=True) + @click.option('--print-location', is_flag=True) @click.option( '-o', '--output', type=click.Choice(['json', 'yaml', 'table', 'wide']) ) - def get(bento, limit, ascending_order, output): + def get(bento, limit, ascending_order, print_location, output): if ':' in bento: name, version = bento.split(':') else: @@ -117,6 +118,9 @@ def get(bento, limit, ascending_order, output): CLI_COLOR_ERROR, ) return + if print_location: + _echo(get_bento_result.bento.uri.uri) + return _print_bento_info(get_bento_result.bento, output) return elif name: