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

Debug output for addAlias is incorrect #1602

Closed
remkop opened this issue Feb 25, 2022 · 0 comments
Closed

Debug output for addAlias is incorrect #1602

remkop opened this issue Feb 25, 2022 · 0 comments
Milestone

Comments

@remkop
Copy link
Owner

remkop commented Feb 25, 2022

The addAlias and removeAlias method incorrectly print the qualified name of the parent command instead of the qualified name of the command whose alias is being added.

Example:

top
  |
  +-- sub (alias: s)

The above would print:

[picocli DEBUG] Creating CommandSpec for TopCommand@557a1e2d with factory picocli.CommandLine$DefaultFactory
[picocli DEBUG] Creating CommandSpec for class SubCommand with factory picocli.CommandLine$DefaultFactory
[picocli DEBUG] Getting a SubCommand  instance from factory picocli.CommandLine$DefaultFactory@c7a975a
[picocli DEBUG] Factory returned a SubCommand  instance (2c1b9e4b)
[picocli DEBUG] Adding subcommand 'sub' to 'top'
[picocli DEBUG] Adding alias 's' for 'top'

That last line should be:

[picocli DEBUG] Adding alias 'top s' for 'top sub'
            private void addAlias(String alias, String name, CommandLine subCommandLine, Tracer t) {
                if (t.isDebug()) {t.debug("Adding alias '%s' for '%s'%n", (subCommandLine.parent() == null ? "" : subCommandLine.parent().qualifiedName() + " ") + alias, subCommandLine.qualifiedName());}
@remkop remkop added this to the 4.7 milestone Feb 25, 2022
@remkop remkop closed this as completed in a3c5fcc Feb 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant