ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ran-z <...@git.apache.org>
Subject [GitHub] incubator-ariatosca pull request #107: ARIA-148 CLI display commands
Date Wed, 10 May 2017 12:43:08 GMT
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.
---

Mime
View raw message