Skip to content

Initializer

init(commands:defaultCommand:enableAutocomplete:)

Creates a new ConfiguredCommands struct. This is usually done by calling resolve(for:) on AsyncCommands.
init(commands: [String : any AnyAsyncCommand] = [:], defaultCommand: (any AnyAsyncCommand)? = nil, enableAutocomplete: Bool = false)

Parameters

commands

Top-level available commands, stored by unique name.

defaultCommand

If set, this is the default top-level command that should run if no other commands are specified.

enableAutocomplete

If true, an autocomplete subcommand will be added to any created AsyncCommandGroup.

The autocomplete command generates shell completion scripts that can be loaded from shell configuration files to provide autocompletion for the entire command hierarchy and its command-line arguments.

enableAutocomplete should only be set to true for a root command group. Any nested subcommands will automatically be included in the completion script generation process.