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


Generates a bash completion script for the specified command class.


-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.



One or more argument files containing options.


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

Exit Codes:


Successful program execution


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.


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


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


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.


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