Documentation
¶
Overview ¶
Package cmd provides the structs and methods for building Juju commands. Commands need to provide an `Info` method that returns an Info struct.
The info struct contains: Name, Args, Purpose and a detailed description (Doc). This information is used to provide the default help for the command.
In the same package, there is `CommandBase` whose purpose is to be composed into new commands, and provides a default no-op SetFlags implementation, a default Init method that checks for no extra args, and a default Help method.
`Supercommand`s are commands that do many things, and have "sub-commands" that provide this functionality. Git and Bazaar are common examples of "supercommands". Subcommands must also provide the `Command` interface, and are registered using the `Register` method. The name and aliases are registered with the supercommand. If there is a duplicate name registered, the whole thing panics. For the time being, the only supercommand that we have is `wait-for` (https://juju.is/docs/juju/juju-wait-for) and the supercommand pattern is not going to be adopted anymore in the near future. Example: juju wait-for unit mysql/0
Supercommands need to be created with the `NewSuperCommand` function in order to provide a fully constructed object.
All supercommand instances get a help command. Every supercommand gets a help command which provides the basic help functionality to its respective subcommands.
Help topics have a `name` which is what is matched from the command line, a `short` one line description that is shown when `<cmd> help` is called, and a `long` text that is output when the topic is requested.
Index ¶
- Variables
- func Info(i *cmd.Info) *cmd.Info
- func IsPiped(ctx *cmd.Context) bool
- func IsUserAbortedError(err error) bool
- func NewSuperCommand(p cmd.SuperCommandParams) *cmd.SuperCommand
- func UserConfirmName(verificationName string, objectType string, ctx *cmd.Context) error
- func UserConfirmYes(ctx *cmd.Context) error
Constants ¶
This section is empty.
Variables ¶
var DefaultLog = &cmd.Log{ DefaultConfig: os.Getenv(osenv.JujuLoggingConfigEnvKey), }
DefaultLog is the default command logging implementation.
Functions ¶
func IsPiped ¶
IsPiped determines if the command was used in a pipe and, hence, it's stdin is not usable for user input.
func IsUserAbortedError ¶
IsUserAbortedError returns true if err is of type userAbortedError.
func NewSuperCommand ¶
func NewSuperCommand(p cmd.SuperCommandParams) *cmd.SuperCommand
NewSuperCommand is like cmd.NewSuperCommand but it adds juju-specific functionality: - The default logging configuration is taken from the environment; - The version is configured to the current juju version; - The additional version information is sourced from juju/juju/version; - The command emits a log message when a command runs.
func UserConfirmName ¶
UserConfirmName returns an error if we do not read a "name" of the model/controller/etc from user input.
func UserConfirmYes ¶
UserConfirmYes returns an error if we do not read a "y" or "yes" from user input.
Types ¶
This section is empty.
Directories
¶
Path | Synopsis |
---|---|
initialize/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
utils/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
internal
|
|
loginprovider
Package loginprovider contains login providers required only by the Juju CLI.
|
Package loginprovider contains login providers required only by the Juju CLI. |
application/bundle/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
application/deployer/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
application/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
application/store/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
application/utils/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
caas/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
charmhub
Package charmhub implements the Charmhub-related CLI commands, such as "juju download", "juju find", and "juju info".
|
Package charmhub implements the Charmhub-related CLI commands, such as "juju download", "juju find", and "juju info". |
charmhub/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
cloud/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
commands/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
config
Package config provides a common base struct to be used for Juju's various config commands (config, model-config, controller-config, model-defaults).
|
Package config provides a common base struct to be used for Juju's various config commands (config, model-config, controller-config, model-defaults). |
controller
Package controller groups various commands that are based on talking directly to the controller, and not environments in the controller.
|
Package controller groups various commands that are based on talking directly to the controller, and not environments in the controller. |
interact
Package interact provides helper methods for interacting with the CLI user at command run time.
|
Package interact provides helper methods for interacting with the CLI user at command run time. |
machine/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
secrets/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
space/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
ssh/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
storage
Package storage implements the "juju storage" command, which provides a storage management interface for manipulating and inspecting storage entities (volumes, filesystems, charm storage).
|
Package storage implements the "juju storage" command, which provides a storage management interface for manipulating and inspecting storage entities (volumes, filesystems, charm storage). |
The `jujud` binary provides, among other things, commands that are used in agent definition files to spawn various agents.
|
The `jujud` binary provides, among other things, commands that are used in agent definition files to spawn various agents. |
agent/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
reboot/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
agent/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
plugins
|
|