Synopsis

picocli.AutoComplete [-fhVw] [-c=<factoryClass>] [-n=<commandName>] [-o=<autoCompleteScript>] [@<filename>…​] <commandLineFQCN>

Description

Generates a bash completion script for the specified command class.

Options

-c, --factory=<factoryClass>

Optionally specify the fully qualified class name of the custom factory to use to instantiate the command class. When omitted, the default picocli factory is used.

-n, --name=<commandName>

Optionally specify the name of the command to create a completion script for. When omitted, the annotated class @Command(name = "…​") attribute is used. If no @Command(name = …​) attribute exists, '<CLASS-SIMPLE-NAME>' (in lower-case) is used.

-o, --completionScript=<autoCompleteScript>

Optionally specify the path of the completion script file to generate. When omitted, a file named '<commandName>_completion' is generated in the current directory.

-w, --writeCommandScript

Write a '<commandName>' sample command script to the same directory as the completion script.

-f, --force

Overwrite existing script files.

-h, --help

Show this help message and exit.

-V, --version

Print version information and exit.

Arguments

[@<filename>…​]

One or more argument files containing options.

<commandLineFQCN>

Fully qualified class name of the annotated @Command class to generate a completion script for.

Exit Codes:

0

Successful program execution

1

Usage error: user input for the command was incorrect, e.g., the wrong number of arguments, a bad flag, a bad syntax in a parameter, etc.

2

The specified command script exists (Specify --force to overwrite).

3

The specified completion script exists (Specify --force to overwrite).

4

An exception occurred while generating the completion script.

System Properties:

Set the following system properties to control the exit code of this program:

  • "picocli.autocomplete.systemExitOnSuccess" call System.exit(0) when execution completes normally.

  • "picocli.autocomplete.systemExitOnError" call System.exit(ERROR_CODE) when an error occurs.

If these system properties are not defined or have value "false", this program completes without terminating the JVM.

Example

java -cp "myapp.jar;picocli-4.5.2.jar" \
            picocli.AutoComplete my.pkg.MyClass