Project

Profile

Help

Issue #503

format of --help output for pulp-admin and pulp-consumer

Added by igulina@redhat.com over 6 years ago. Updated over 2 years ago.

Status:
CLOSED - WONTFIX
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
1. Low
Version:
2.4 Beta
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

Description of problem:

The current version of TAB completion for pulp-admin and pulp-consumer works on-the-fly. TAB completion for sections/commands/options is taken (grep'ed) from the --help output. It returns sections/commands/options from lines which starts with 2 spaces.

A great benefit of it is that on-the-fly TAB completion implementation doesn't depend on the updates of pulp's sections/commands/options and doesn't require any updates if there are any in pulp functionality. Moreover, it's possible to control completion if there is an error in a pulp command input. The code is very simple and doesn't contain lists/functions of all possible sections/commands/options.

Unfortunately help output for pulp-consumer contains a section 'Filters' and it's description starts with a new line and two spaces. In this case, TAB completion takes words from this description as possible sections.

At the same time, description of 'Command' and 'Description' sections start on the same line after colon.

Suggestion: Description of help sections for pulp-admin or pulp-consumer components should be universal for all of them and start after colon on the same line after the section name. If there are more than one line in the description it should not start with 2 spaces.

[SECTION NAME]: Description Text.

[SECTION NAME]: Description Text.
Description Text.

[SECTION NAME]: Description Text.
Description Text.

I could use pattern which would return expression in []:

[ section - ]description
[ --longoption - ]description
[ --long-option -]description
[ --long-option, -l -]description
[ --longoption, -l -]description
[ -l -]description

but at the same time a description of the help section may contain a line which matches those patterns:

[ word - ]word

I think, colorized/highlighted sections/options/commands like in --map is not an option. If an user has some personal terminal view settings, (maybe) it will break everything.

So far, I don't see other solution how to distinguish pulp sections/commands/options from the help output. Maybe it's possible to create a list of all possible options in the beginning of help output like the man pages have, but I don't think it's reasonable to overload help output.

How reproducible:
always

Steps to Reproduce:

pulp-consumer -u admin -p admin puppet repos --help

Command: repos
Description: searches for repositories on the server

Available Arguments:

--filters - filters provided as JSON in mongo syntax. This will override any
            options specified from the 'Filters' section below.
--limit   - max number of items to return
--skip    - number of items to skip
--sort    - field name, a comma, and either the word "ascending" or
            "descending". The comma and direction are optional, and the
            direction defaults to ascending. Do not put a space before or
            after the comma. For multiple fields, use this option multiple
            times. Each one will be applied in the order supplied.
--fields  - comma-separated list of resource fields. Do not include spaces.
            Default is all fields.

Filters
These are basic filtering options that will be AND'd together. These will be
ignored if --filters= is specified. Any option may be specified multiple
times. The value for each option should be a field name and value to match
against, specified as "name=value". Example: $ pulp-admin <command>
--gt='content_unit_count=0'

--str-eq - match where a named attribute equals a string value exactly.
--int-eq - match where a named attribute equals an int value exactly.
--match  - for a named attribute, match a regular expression using the mongo
           regex engine.
--in     - for a named attribute, match where value is in the provided list of
           values, expressed as one row of CSV
--not    - field and expression to omit when determining units for inclusion
--gt     - matches resources whose value for the specified field is greater
           than the given value
--gte    - matches resources whose value for the specified field is greater
           than or equal to the given value
--lt     - matches resources whose value for the specified field is less than
           the given value
--lte    - matches resources whose value for the specified field is less than
           or equal to the given value

pulp-consumer -u admin -p admin puppet repos[TAB][TAB]

--fields --gt --help --in --limit --lte --not --sort --filters --gte ignored --int-eq --lt --match --skip --s

Notice, "ignored" shouldn't be there.

I caught it only for 'Filters' section. Maybe there are others with the same problem.

+ This bug was cloned from Bugzilla Bug #1134048 +

History

#1 Updated by igulina@redhat.com over 6 years ago

There is the same problem for pulp-admin, if there is the 'Filters' section on the help. "These" and "ignored" shouldn't show up:

pulp-admin rpm repo content category [TAB][TAB]

-a -b -d --fields --gt --help --in --limit --lte --not --skip --str-eq
--after --before --details --filters --gte ignored --int-eq --lt --match --repo-id --sort These

pulp-admin rpm repo content category --help

Command: category
Description: search for package categories (groups of package groups) in a
repository

Available Arguments:

--filters     - filters provided as JSON in mongo syntax. This will override
                any options specified from the 'Filters' section below.
--limit       - max number of items to return
--skip        - number of items to skip
--sort        - field name, a comma, and either the word "ascending" or
                "descending". The comma and direction are optional, and the
                direction defaults to ascending. Do not put a space before or
                after the comma. For multiple fields, use this option multiple
                times. Each one will be applied in the order supplied.
--fields      - comma-separated list of resource fields. Do not include
                spaces. Default is all fields.
--repo-id     - (required) identifies the repository to search within
--after, -a   - matches units added to the source repository on or after the
                given time; specified as a timestamp in iso8601 format
--before, -b  - matches units added to the source repository on or before the
                given time; specified as a timestamp in iso8601 format
--details, -d - show association details

Filters
These are basic filtering options that will be AND'd together. These will be
ignored if --filters= is specified. Any option may be specified multiple
times. The value for each option should be a field name and value to match
against, specified as "name=value". Example: $ pulp-admin <command>
--gt='content_unit_count=0'

--str-eq - match where a named attribute equals a string value exactly.
--int-eq - match where a named attribute equals an int value exactly.
--match  - for a named attribute, match a regular expression using the mongo
           regex engine.
--in     - for a named attribute, match where value is in the provided list of
           values, expressed as one row of CSV
--not    - field and expression to omit when determining units for inclusion
--gt     - matches resources whose value for the specified field is greater
           than the given value
--gte    - matches resources whose value for the specified field is greater
           than or equal to the given value
--lt     - matches resources whose value for the specified field is less than
           the given value
--lte    - matches resources whose value for the specified field is less than
           or equal to the given value

+ This comment was cloned from Bugzilla #1134048 comment 1 +

#2 Updated by bmbouter over 2 years ago

  • Status changed from NEW to CLOSED - WONTFIX

#3 Updated by bmbouter over 2 years ago

  • Severity set to 1. Low

Pulp 2 is approaching maintenance mode, and this Pulp 2 ticket is not being actively worked on. As such, it is being closed as WONTFIX. Pulp 2 is still accepting contributions though, so if you want to contribute a fix for this ticket, please reopen or comment on it. If you don't have permissions to reopen this ticket, or you want to discuss an issue, please reach out via the developer mailing list.

#4 Updated by bmbouter over 2 years ago

  • Tags Pulp 2 added

Please register to edit this issue

Also available in: Atom PDF