mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-11-26 00:52:07 +01:00
Add hidden generate-completion command
This command can be used to generate zsh/bash autocompletion. See https://picocli.info/autocomplete.html
This commit is contained in:
parent
cb16c1ce84
commit
6c392addc1
1 changed files with 12 additions and 5 deletions
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
package sop.cli.picocli;
|
package sop.cli.picocli;
|
||||||
|
|
||||||
|
import picocli.AutoComplete;
|
||||||
import picocli.CommandLine;
|
import picocli.CommandLine;
|
||||||
import sop.SOP;
|
import sop.SOP;
|
||||||
import sop.cli.picocli.commands.ArmorCmd;
|
import sop.cli.picocli.commands.ArmorCmd;
|
||||||
|
@ -30,7 +31,8 @@ import sop.cli.picocli.commands.VersionCmd;
|
||||||
GenerateKeyCmd.class,
|
GenerateKeyCmd.class,
|
||||||
SignCmd.class,
|
SignCmd.class,
|
||||||
VerifyCmd.class,
|
VerifyCmd.class,
|
||||||
VersionCmd.class
|
VersionCmd.class,
|
||||||
|
AutoComplete.GenerateCompletion.class
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
public class SopCLI {
|
public class SopCLI {
|
||||||
|
@ -47,12 +49,17 @@ public class SopCLI {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int execute(String[] args) {
|
public static int execute(String[] args) {
|
||||||
return new CommandLine(SopCLI.class)
|
CommandLine cmd = new CommandLine(SopCLI.class);
|
||||||
.setCommandName(EXECUTABLE_NAME)
|
// Hide generate-completion command
|
||||||
|
CommandLine gen = cmd.getSubcommands().get("generate-completion");
|
||||||
|
gen.getCommandSpec().usageMessage().hidden(true);
|
||||||
|
|
||||||
|
cmd.setCommandName(EXECUTABLE_NAME)
|
||||||
.setExecutionExceptionHandler(new SOPExecutionExceptionHandler())
|
.setExecutionExceptionHandler(new SOPExecutionExceptionHandler())
|
||||||
.setExitCodeExceptionMapper(new SOPExceptionExitCodeMapper())
|
.setExitCodeExceptionMapper(new SOPExceptionExitCodeMapper())
|
||||||
.setCaseInsensitiveEnumValuesAllowed(true)
|
.setCaseInsensitiveEnumValuesAllowed(true);
|
||||||
.execute(args);
|
|
||||||
|
return cmd.execute(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SOP getSop() {
|
public static SOP getSop() {
|
||||||
|
|
Loading…
Reference in a new issue