-
Notifications
You must be signed in to change notification settings - Fork 423
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
Autocompletion bug for subcommands in zsh #178
Comments
Tracked it down to a problem in the
|
|
Hello, I'm having the same issue in bash. |
Can you provide a small program that demonstrates the issue so I can try to reproduce it? |
So when trying to contain the issue to sample project, at first I could not replicate it. Then I saw that my subcommand have a separator between words and that was the culprit. Don't know if it is fixable, but I'll post the testcase anyway.
@Command(
name = "rcmd",
mixinStandardHelpOptions = true,
subcommands = {TestCase.Sub1Command.class, TestCase.Sub2Command.class}
)
public class TestCase {
public static void main(String... args) {
CommandLine command = new CommandLine(new TestCase());
command.parseWithHandler(new RunAll(), args);
}
@Command(name = "sub-1", mixinStandardHelpOptions = true)
public static class Sub1Command implements Runnable{
@Option(names = "option1")
int option1;
@Option(names = "flag1")
boolean flag1;
public void run() {
System.out.println(String.format("option1=%d, flag1=%s", option1, flag1));
}
}
@Command(name = "sub-2", mixinStandardHelpOptions = true)
public static class Sub2Command implements Runnable{
@Option(names = "option2")
int option2;
@Option(names = "flag2")
boolean flag2;
public void run() {
System.out.println(String.format("option2=%d, flag2=%s", option2, flag2));
}
}
} Bash script for autocompletion #!/usr/bin/env bash
PICOCLI_JAR=picocli-3.0.0-beta-2.jar
MAIN_DIR=src/main/java/
MAIN_CLASS=TestCase
alias rcmd='java -cp $PICOCLI_JAR;$MAIN_CLASS $MAIN_CLASS'
echo "created alias rcmd"
javac -cp $PICOCLI_JAR $MAIN_DIR/$MAIN_CLASS.java
java -cp "$PICOCLI_JAR:$MAIN_DIR" picocli.AutoComplete $MAIN_CLASS -f
. rcmd_completion
echo "created autocompletion" EDIT: CMDS0=(sub1) --> CMDS0=(sub-1)
CMDS1=(sub2) --> CMDS1=(sub-2) |
Aha! Thank you for figuring that out. This is certainly fixable. The problem is the Would you mind opening a separate ticket for this? |
Closing this ticket: following up on supporting hyphens in subcommands in #371. |
on ZSH, the
hierarchy
test command always shows the top-level completions, even after a subcommand was selected.Expected:
Actual:
The text was updated successfully, but these errors were encountered: