Uploaded image for project: 'Skara'
  1. Skara
  2. SKARA-1275

An unknown sub-command gives a confusing error message

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.0
    • None
    • cli
    • None

      When using the the unknown sub-command, the client will execute the default command which can output the unexpected message.

      The right behavior:

      ```
      $ git-pr lis

      error: unknown sub-command: lis

      Available sub-commands are:
      // Ignore the following output.
      ```

      The wrong behavior:

      ```
      $ git-pr lis 123

      error: unexpected input: 123 // <-- here wrong
      usage: git-pr [options] [<COMMAND>]
      -h, --help Show help
      --verbose Turn on verbose output
      --debug Turn on debugging output
      --version Print the version of this tool
      ```

      The default sub-command is `git-pr help`, so when the client doesn't identify the sub-command `git-pr lis`, it will execute `git-pr help` and will pass `lis 123` as the argument to the `git-pr help` command. And the `git-pr help` can resolve only one argument, which is `lis` in this example, so it would output `error: unexpected input: 123`.

            gli Guoxiong Li
            gli Guoxiong Li
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: