Skip to content

generateCompletion

Generated reference page for the generateCompletion function export.

Signatures

ts
function generateCompletion(schema: CLISchema, shell: Shell, options?: CompletionOptions): string;
ParameterTypeDescription
schemaCLISchemaThe CLI schema describing commands, flags, and args.
shellShellTarget shell.
optionsCompletionOptions | undefinedOptional generator configuration such as function naming
and root default-command completion behavior.

Members

Members

generateCompletion

Generate a completion script for the given shell.

This is the primary completion entrypoint for most consumers. Pass a CLI schema and target shell, then write the returned script to a file or source it directly from the command line.

ts
(schema: CLISchema, shell: Shell, options?: CompletionOptions): string;

Examples

ts
const script = generateCompletion(app.schema, 'bash');
// e.g. source <(mycli completions bash)

See Also

Released under the MIT License.