Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't include binary name and version when printing help of any of the binaries #2051

Closed
reubenmiller opened this issue Jul 2, 2023 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation refactoring Developer value theme:cli Theme: cli related topics
Milestone

Comments

@reubenmiller
Copy link
Contributor

Is your refactoring request related to a problem? Please describe.

When printing the help text of a command (e.g. c8y-firmware-plugin --help), the binary name and version is displayed on the first line of the help text.

Having the information within the help text makes parsing the output more complicated for automation purposes (e.g. generating automatic do documents from the command output as the version changes more frequently than the help contents).

Below shows an example of the version information which is printed on the first line.

c8y-firmware-plugin 0.11.0-145-ge59e17be

Here is the full example:

Command

c8y-firmware-plugin --help

Output

c8y-firmware-plugin 0.11.0-145-ge59e17be
Thin-edge device firmware management for Cumulocity

USAGE:
    c8y-firmware-plugin [OPTIONS]

OPTIONS:
        --config-dir <CONFIG_DIR>
            [default: /etc/tedge]

        --debug
            Turn-on the debug log level.

            If off only reports ERROR, WARN, and INFO If on also reports DEBUG and TRACE

    -h, --help
            Print help information

    -i, --init
            Create required directories

    -V, --version
            Print version information

Describe the solution you'd like

  • Don't display the binary name and version on the first line of the help/usage text for any of the project's release binaries (e.g. tedge, tedge-agent, tedge-mapper, c8y-*-plugin, tedge-apt-plugin etc.

In comparison with other tooling, it is more common to just display the version via --version (or something similar), rather than printing it out when using --help.

  • curl --help
  • docker --help
  • grep --help

All of those commands have a dedicated version flag should the user want to know the version of the command they are using.

Note

  • I realise this is a bit of a bike-shed issue, however if no-one really cares it will at least make documentation automation slightly easier. Also the requested behaviour has already been accepted as the default for clap-rs PR4160

Describe alternatives you've considered

Additional context

@reubenmiller reubenmiller added documentation Improvements or additions to documentation refactoring Developer value theme:cli Theme: cli related topics labels Jul 2, 2023
@didier-wenzek
Copy link
Contributor

Mostly a matter to upgrade to clap ="4.10" with some issues with deprecated methods:

error[E0599]: no method named `parse` found for struct `Arg` in the current scope
  --> crates/core/tedge/src/cli/mqtt/cli.rs:37:29
   |
37 |         #[clap(short, long, parse(try_from_str = parse_qos), default_value = "0")]
   |                             ^^^^^ method not found in `Arg`
``

@didier-wenzek
Copy link
Contributor

As a side effect of bumping clap version, --help no longer show the version, and this for all the tedge-xxx executables.

@gligorisaev
Copy link
Contributor

QA has thoroughly checked the feature and here are the results:

  • Test for ticket exists in the test suite.
  • QA has tested the feature and it meets the required specifications.

Checked for:

  • c8y-firmware-plugin
  • tedge
  • tedge-agent
  • tedge-mapper
  • tedge-apt-plugin
  • c8y-configuration-plugin
  • c8y-log-plugin
  • c8y-remote-access-plugin

@reubenmiller reubenmiller added this to the 0.13.0 milestone Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation refactoring Developer value theme:cli Theme: cli related topics
Projects
None yet
Development

No branches or pull requests

3 participants