Add a Command to the CLI's CommandRegistry.
If only one non-modifier Command is added, the CLI will operate as a single command CLI and the provided command will be set as a default command. If more than one command is added, the CLI will operate as a multi-command CLI. In this case the default command will be set to a help command.
Add a ServiceProvider to the CLI's ServiceProviderRegistry.
This will register the ServiceProvider, add any provided services to the Context and register any provided Command instances.
the ServiceProvider to add.
Base implementation of a CLI.
By default the following service providers are added:
NOTE: The
ConfigurationServiceProviderwill not be added if the requiredallow-readandallow-writepermissions are not granted. It can also be excluded if desired via a constructor argument.Optionally enabled via BaseCLIFeatureOptions:
keyReaderis optional. If omitted, or if the stderr Terminal is not a TTY, prompting is unavailable: PrompterServiceProvider (and ArgumentPrompterServiceProvider, if enabled) are simply not registered. IfpromptingEnabledistruein that situation, run throws rather than failing later inside a prompt. Similarly ImagePrinterServiceProvider is only registered if the stdout Terminal is a TTY.By default the following commands are added: