Bug #16225

Allowed combinations of expanded options aren't obvious

Added by Tomáš Strachota 11 months ago. Updated 6 months ago.

Status:New
Priority:Normal
Assigned To:-
Category:Hammer core
Target version:Foreman - Team Marek backlog
Difficulty: Bugzilla link:1182232
Found in release: Pull request:
Story points-
Velocity based estimate-

Description

When hammer automatically expands options for an action (typically index action) it doesn't mark what combinations of options are allowed. This is very confusing in combination with the fact that additional parameters are just ignored silently.

An example is listing errata (in hammer-cli-katello), where api allows either to list all errata or scope by repository. Hammer expands the repository scope to multiple options including --organization and --product. It evokes false idea that the command should be able to filter also by organization or product.

Usage:
    hammer erratum list [OPTIONS]

Options:
 --by BY                                                   Field to sort the results on
 --content-view CONTENT_VIEW_NAME                          Content view name to search by
 --content-view-filter CONTENT_VIEW_FILTER_NAME            Name to search by
 --content-view-filter-id CONTENT_VIEW_FILTER_ID           filter identifier
 --content-view-id CONTENT_VIEW_ID                         content view numeric identifier
 --content-view-version CONTENT_VIEW_VERSION_VERSION       Content view version number
 --content-view-version-id CONTENT_VIEW_VERSION_ID         Content view version identifier
 --cve CVE                                                 CVE identifier
 --environment ENVIRONMENT_NAME                            Name to search by
 --environment-id ENVIRONMENT_ID                            
 --errata-restrict-applicable ERRATA_RESTRICT_APPLICABLE   show only errata with one or more applicable hosts
                                                           One of true/false, yes/no, 1/0.
 --errata-restrict-installable ERRATA_RESTRICT_INSTALLABLE show only errata with one or more installable hosts
                                                           One of true/false, yes/no, 1/0.
 --full-results FULL_RESULTS                               Whether or not to show all results
                                                           One of true/false, yes/no, 1/0.
 --order ORDER                                             Sort field and order, eg. 'name DESC'
 --organization ORGANIZATION_NAME                          Organization name to search by
 --organization-id ORGANIZATION_ID                         organization ID
 --organization-label ORGANIZATION_LABEL                   Organization label to search by
 --page PAGE                                               Page number, starting at 1
 --per-page PER_PAGE                                       Number of results per page to return
 --product PRODUCT_NAME                                    Product name to search by
 --product-id PRODUCT_ID                                   product numeric identifier
 --repository REPOSITORY_NAME                              Repository name to search by
 --repository-id REPOSITORY_ID                             repository ID
 --search SEARCH                                           Search string
 -h, --help                                                print help

This issue is spread in commands across all hammer commands with option expansion. The key is to give users more information about what combinations are allowed. It can be also in form of feedback from error message.

Even though the simplest solution might be to deal with the issue on per-command basis in option validation, it's worth investigating if there is a good enough generic solution. If we decide to go the per-command way this issue should become a tracker.


Related issues

Related to Hammer CLI - Feature #4128: hammer $command --help should show mandatory and optional... New 01/20/2014

History

#1 Updated by Tomáš Strachota 10 months ago

  • Related to Feature #4128: hammer $command --help should show mandatory and optional parameter differences added

#2 Updated by Tomáš Strachota 6 months ago

Just for the record, there's RFC about this topic:
https://github.com/theforeman/rfcs/pull/32

Also available in: Atom PDF