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

Multiple multi-level paths in one command causes duplicates in help text #126

Open
d-fischer opened this issue Aug 15, 2022 · 0 comments
Open

Comments

@d-fischer
Copy link

Description

If you define multiple nested paths for a command, and then try to execute a shared partial path of it, you get an error message where the first path is displayed multiple times.

Source

const { Builtins, Command, runExit } = require('clipanion');

runExit(
    { binaryName: 'test' },
    [
        Builtins.HelpCommand,
        class extends Command {
            static paths = [['foo', 'bar'], ['foo', 'baz']];
            async execute() {
                console.log('hi');
            }
        }
    ],
    ['foo']
);

Expected result

Unknown Syntax Error: Command not found; did you mean:

$ test foo bar

While running foo

or

Unknown Syntax Error: Command not found; did you mean one of:

  0. test foo bar
  1. test foo baz

While running foo

It's really up to you (or a config option?) whether to include multiple paths for one command in the help text.

Actual result

Unknown Syntax Error: Command not found; did you mean one of:

  0. test foo bar
  1. test foo bar

While running foo

As you can see, while baz isn't shown at all (which, arguably, might be fine), bar is shown twice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant