public class AutoComplete extends Object
Modifier and Type | Class and Description |
---|---|
static class |
AutoComplete.GenerateCompletion
Command that generates a Bash/ZSH completion script for its top-level command.
|
Modifier and Type | Field and Description |
---|---|
static int |
EXIT_CODE_COMMAND_SCRIPT_EXISTS
Exit code of this application when the specified command script exists (2).
|
static int |
EXIT_CODE_COMPLETION_SCRIPT_EXISTS
Exit code of this application when the specified completion script exists (3).
|
static int |
EXIT_CODE_EXECUTION_ERROR
Exit code of this application when an exception was encountered during operation (4).
|
static int |
EXIT_CODE_INVALID_INPUT
Exit code of this application when the specified command line arguments are invalid (1).
|
static int |
EXIT_CODE_SUCCESS
Normal exit code of this application (0).
|
Modifier and Type | Method and Description |
---|---|
static String |
bash(String scriptName,
CommandLine commandLine)
Generates and returns the source code for an autocompletion bash script for the specified picocli-based application.
|
static void |
bash(String scriptName,
File out,
File command,
CommandLine commandLine)
Generates source code for an autocompletion bash script for the specified picocli-based application,
and writes this script to the specified
out file, and optionally writes an invocation script
to the specified command file. |
static int |
complete(CommandLine.Model.CommandSpec spec,
String[] args,
int argIndex,
int positionInArg,
int cursor,
List<CharSequence> candidates) |
static void |
main(String... args)
Generates a bash completion script for the specified command class.
|
public static final int EXIT_CODE_SUCCESS
public static final int EXIT_CODE_INVALID_INPUT
public static final int EXIT_CODE_COMMAND_SCRIPT_EXISTS
public static final int EXIT_CODE_COMPLETION_SCRIPT_EXISTS
public static final int EXIT_CODE_EXECUTION_ERROR
public static void main(String... args)
args
- command line options. Specify at least the commandLineFQCN
mandatory parameter, which is
the fully qualified class name of the annotated @Command
class to generate a completion script for.
Other parameters are optional. Specify -h
to see details on the available options.public static void bash(String scriptName, File out, File command, CommandLine commandLine) throws IOException
out
file, and optionally writes an invocation script
to the specified command
file.scriptName
- the name of the command to generate a bash autocompletion script forcommandLine
- the CommandLine
instance for the command line applicationout
- the file to write the autocompletion bash script source code tocommand
- the file to write a helper script to that invokes the command, or null
if no helper script file should be writtenIOException
- if a problem occurred writing to the specified filespublic static String bash(String scriptName, CommandLine commandLine)
scriptName
- the name of the command to generate a bash autocompletion script forcommandLine
- the CommandLine
instance for the command line applicationpublic static int complete(CommandLine.Model.CommandSpec spec, String[] args, int argIndex, int positionInArg, int cursor, List<CharSequence> candidates)