Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 25C6D200C73 for ; Wed, 10 May 2017 14:43:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 23D48160BB4; Wed, 10 May 2017 12:43:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 6A437160BA8 for ; Wed, 10 May 2017 14:43:13 +0200 (CEST) Received: (qmail 95940 invoked by uid 500); 10 May 2017 12:43:12 -0000 Mailing-List: contact dev-help@ariatosca.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ariatosca.incubator.apache.org Delivered-To: mailing list dev@ariatosca.incubator.apache.org Received: (qmail 95927 invoked by uid 99); 10 May 2017 12:43:11 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 May 2017 12:43:11 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 40A2C1A0E1A for ; Wed, 10 May 2017 12:43:11 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.02 X-Spam-Level: X-Spam-Status: No, score=-4.02 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id zcGqSDgLzDHW for ; Wed, 10 May 2017 12:43:10 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 4F8785FE02 for ; Wed, 10 May 2017 12:43:09 +0000 (UTC) Received: (qmail 95862 invoked by uid 99); 10 May 2017 12:43:08 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 May 2017 12:43:08 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 41EF0DFC2E; Wed, 10 May 2017 12:43:08 +0000 (UTC) From: ran-z To: dev@ariatosca.incubator.apache.org Reply-To: dev@ariatosca.incubator.apache.org References: In-Reply-To: Subject: [GitHub] incubator-ariatosca pull request #107: ARIA-148 CLI display commands Content-Type: text/plain Message-Id: <20170510124308.41EF0DFC2E@git1-us-west.apache.org> Date: Wed, 10 May 2017 12:43:08 +0000 (UTC) archived-at: Wed, 10 May 2017 12:43:14 -0000 Github user ran-z commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/107#discussion_r115729149 --- Diff: aria/cli/commands/service_templates.py --- @@ -43,32 +45,51 @@ def service_templates(): @aria.argument('service-template-name') @aria.options.verbose() @aria.pass_model_storage +@aria.options.show_all +@aria.options.show_types +@aria.options.show_json +@aria.options.show_yaml @aria.pass_logger -def show(service_template_name, model_storage, logger): - """Show information for a specific service templates +def show(service_template_name, model_storage, all, types, json, yaml, logger): + """Show information for a specific service template `SERVICE_TEMPLATE_NAME` is the name of the service template to show information on. """ - logger.info('Showing service template {0}...'.format(service_template_name)) service_template = model_storage.service_template.get_by_name(service_template_name) - service_template_dict = service_template.to_dict() - service_template_dict['#services'] = len(service_template.services) - column_formatters = \ - dict(description=table.trim_formatter_generator(DESCRIPTION_FIELD_LENGTH_LIMIT)) - columns = SERVICE_TEMPLATE_COLUMNS + ['#services'] - table.print_data(columns, service_template_dict, 'Service-template:', - column_formatters=column_formatters, col_max_width=50) - - if service_template_dict['description'] is not None: - logger.info('Description:') - logger.info('{0}{1}'.format(service_template_dict['description'].encode('UTF-8') or '', - os.linesep)) - - if service_template.services: - logger.info('Existing services:') - for service in service_template.services: - logger.info('\t{0}'.format(service.name)) + if json or yaml: --- End diff -- i'm a bit confused by this. so `yaml`, `json`, and `all` all mean all, and `json` and `yaml` can be used simulatniously but only `json` will get printed. Re the latter problem, please have a look at `aria.py` for how to make flags mutually-exclusive. re the former, it might be better to also have the `all` flag as mutually-exclusive with the other two.. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---