Snapcraft help command showing wrong usage

When you run snapcraft help <command>, the correct help information shows up, but with the wrong usage.

For example, running snapcraft help push gives the following output:

Usage: snapcraft help [OPTIONS] <snap-file>

when it should be giving:

Usage: snapcraft push [OPTIONS] <snap-file>

You’ll notice the same issue for other commands with help.

In constrast, CLI commands such as hugo help serve, docker help run, and even snap help info all return the usage string as you would expect.

Note that you can get help from the subcommand itself:

$ snapcraft push --help
Usage: snapcraft push [OPTIONS] <snap-file>

  Push <snap-file> to the store.

  By passing --release with a comma separated list of channels the snap
  would be released to the selected channels if the store review passes for
  this <snap-file>.

  This operation will block until the store finishes processing this <snap-
  file>.

  If --release is used, the channel map will be displayed after the
  operation takes place.

  Examples:
      snapcraft push my-snap_0.1_amd64.snap
      snapcraft push my-snap_0.2_amd64.snap --release edge
      snapcraft push my-snap_0.3_amd64.snap --release candidate,beta

Options:
  --release <channels>  Optional comma separated list of channels to release
                        <snap-file>
  --help                Show this message and exit.

But I agree it should also work with snapcraft help ...

Problem should be here, but I am no expert in click to quickly tell what’s wrong with it.

Known bug:

Bug #1745040 “help command replaces the name of commands with it…” : Bugs : Snapcraft

PR: https://github.com/snapcore/snapcraft/pull/2429

1 Like