Documentation
¶
Overview ¶
Package cmd implements the CobraCLI commands for the methodazure CLI. Subcommands for the CLI should all live within this package. Logic should be delegated to internal packages and functions to keep the CLI commands clean and focused on CLI I/O.
Package cmd implements the CobraCLI commands for the methodazure CLI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MethodAzure ¶
type MethodAzure struct {
Version string
RootFlags config.RootFlags
AzureConfig config.AzureConfig
OutputConfig writer.OutputConfig
OutputSignal signal.Signal
RootCmd *cobra.Command
VersionCmd *cobra.Command
}
MethodAzure is the main struct for the methodazure CLI. It contains all the necessary fields to run the CLI, including all subcommands. It is also responsible for holding the Azure configuration, Output configuration, and Output signal for use by subcommands. The output signal is used to write the output of the command to the desired output format after the execution of the invoked commands Run function.
func NewMethodAzure ¶
func NewMethodAzure(version string) *MethodAzure
NewMethodAzure returns a new MethodAzure struct with the provided version string. The MethodAzure struct is used to initialize the root command and all subcommands that are used throughout execution of the CLI. We pass the version command in here from the main.go file, where we set the version string during the build process.
func (*MethodAzure) InitRootCommand ¶
func (a *MethodAzure) InitRootCommand()
InitRootCommand initializes the root command for the methodazure CLI. This command is used to set the global flags that are used by all subcommands, such as the region, output format, and output file. It also initializes the version command that prints the version of the CLI. Critically, this sets the PersistentPreRunE and PersistentPostRunE functions that are inherited by all subcommands. The PersistentPreRunE function is used to validate the cloud-config flag and set the Azure configuration. The PersistentPostRunE function is used to write the output of the command to the desired output format after the execution of the invoked command's Run function.
func (*MethodAzure) InitStorageCommand ¶ added in v0.1.1
func (a *MethodAzure) InitStorageCommand()
InitStorageCommand initializes the `methodazure storage` subcommand hierarchy, which deals with enumerating Azure Blob Storage containers and their resources.