cli: Add reference to global options to help text

This commit is contained in:
Alisdair McDiarmid 2021-02-22 09:25:56 -05:00
parent 1de8216a9e
commit 94340b5940
38 changed files with 39 additions and 39 deletions

View File

@ -261,7 +261,7 @@ func (c *ApplyCommand) Synopsis() string {
func (c *ApplyCommand) helpApply() string { func (c *ApplyCommand) helpApply() string {
helpText := ` helpText := `
Usage: terraform apply [options] [PLAN] Usage: terraform [global options] apply [options] [PLAN]
Creates or updates infrastructure according to Terraform configuration Creates or updates infrastructure according to Terraform configuration
files in the current directory. files in the current directory.
@ -323,7 +323,7 @@ Options:
func (c *ApplyCommand) helpDestroy() string { func (c *ApplyCommand) helpDestroy() string {
helpText := ` helpText := `
Usage: terraform destroy [options] Usage: terraform [global options] destroy [options]
Destroy Terraform-managed infrastructure. Destroy Terraform-managed infrastructure.

View File

@ -175,7 +175,7 @@ func (c *ConsoleCommand) modePiped(session *repl.Session, ui cli.Ui) int {
func (c *ConsoleCommand) Help() string { func (c *ConsoleCommand) Help() string {
helpText := ` helpText := `
Usage: terraform console [options] Usage: terraform [global options] console [options]
Starts an interactive console for experimenting with Terraform Starts an interactive console for experimenting with Terraform
interpolations. interpolations.

View File

@ -494,7 +494,7 @@ func (c *FmtCommand) trimNewlines(tokens hclwrite.Tokens) hclwrite.Tokens {
func (c *FmtCommand) Help() string { func (c *FmtCommand) Help() string {
helpText := ` helpText := `
Usage: terraform fmt [options] [DIR] Usage: terraform [global options] fmt [options] [DIR]
Rewrites all Terraform configuration files to a canonical format. Both Rewrites all Terraform configuration files to a canonical format. Both
configuration files (.tf) and variables files (.tfvars) are updated. configuration files (.tf) and variables files (.tfvars) are updated.

View File

@ -44,7 +44,7 @@ func (c *GetCommand) Run(args []string) int {
func (c *GetCommand) Help() string { func (c *GetCommand) Help() string {
helpText := ` helpText := `
Usage: terraform get [options] PATH Usage: terraform [global options] get [options] PATH
Downloads and installs modules needed for the configuration given by Downloads and installs modules needed for the configuration given by
PATH. PATH.

View File

@ -163,7 +163,7 @@ func (c *GraphCommand) Run(args []string) int {
func (c *GraphCommand) Help() string { func (c *GraphCommand) Help() string {
helpText := ` helpText := `
Usage: terraform graph [options] Usage: terraform [global options] graph [options]
Outputs the visual execution graph of Terraform resources according to Outputs the visual execution graph of Terraform resources according to
either the current configuration or an execution plan. either the current configuration or an execution plan.

View File

@ -271,7 +271,7 @@ func (c *ImportCommand) Run(args []string) int {
func (c *ImportCommand) Help() string { func (c *ImportCommand) Help() string {
helpText := ` helpText := `
Usage: terraform import [options] ADDR ID Usage: terraform [global options] import [options] ADDR ID
Import existing infrastructure into your Terraform state. Import existing infrastructure into your Terraform state.

View File

@ -909,7 +909,7 @@ func (c *InitCommand) AutocompleteFlags() complete.Flags {
func (c *InitCommand) Help() string { func (c *InitCommand) Help() string {
helpText := ` helpText := `
Usage: terraform init [options] Usage: terraform [global options] init [options]
Initialize a new or existing Terraform working directory by creating Initialize a new or existing Terraform working directory by creating
initial files, loading any remote state, downloading modules, etc. initial files, loading any remote state, downloading modules, etc.

View File

@ -249,7 +249,7 @@ func (c *LoginCommand) Help() string {
} }
helpText := fmt.Sprintf(` helpText := fmt.Sprintf(`
Usage: terraform login [hostname] Usage: terraform [global options] login [hostname]
Retrieves an authentication token for the given hostname, if it supports Retrieves an authentication token for the given hostname, if it supports
automatic login, and saves it in a credentials file in your home directory. automatic login, and saves it in a credentials file in your home directory.

View File

@ -132,7 +132,7 @@ func (c *LogoutCommand) Help() string {
} }
helpText := ` helpText := `
Usage: terraform logout [hostname] Usage: terraform [global options] logout [hostname]
Removes locally-stored credentials for specified hostname. Removes locally-stored credentials for specified hostname.

View File

@ -97,7 +97,7 @@ func (c *OutputCommand) Outputs(statePath string) (map[string]*states.OutputValu
func (c *OutputCommand) Help() string { func (c *OutputCommand) Help() string {
helpText := ` helpText := `
Usage: terraform output [options] [NAME] Usage: terraform [global options] output [options] [NAME]
Reads an output variable from a Terraform state file and prints Reads an output variable from a Terraform state file and prints
the value. With no additional arguments, output will display all the value. With no additional arguments, output will display all

View File

@ -187,7 +187,7 @@ func (c *PlanCommand) Run(args []string) int {
func (c *PlanCommand) Help() string { func (c *PlanCommand) Help() string {
helpText := ` helpText := `
Usage: terraform plan [options] Usage: terraform [global options] plan [options]
Generates a speculative execution plan, showing what actions Terraform Generates a speculative execution plan, showing what actions Terraform
would take to apply the current configuration. This command will not would take to apply the current configuration. This command will not

View File

@ -149,7 +149,7 @@ func (c *ProvidersCommand) populateTreeNode(tree treeprint.Tree, node *configs.M
} }
const providersCommandHelp = ` const providersCommandHelp = `
Usage: terraform providers [dir] Usage: terraform [global options] providers [dir]
Prints out a tree of modules in the referenced configuration annotated with Prints out a tree of modules in the referenced configuration annotated with
their provider requirements. their provider requirements.

View File

@ -301,7 +301,7 @@ func (c *ProvidersLockCommand) Run(args []string) int {
func (c *ProvidersLockCommand) Help() string { func (c *ProvidersLockCommand) Help() string {
return ` return `
Usage: terraform providers lock [options] [providers...] Usage: terraform [global options] providers lock [options] [providers...]
Normally the dependency lock file (.terraform.lock.hcl) is updated Normally the dependency lock file (.terraform.lock.hcl) is updated
automatically by "terraform init", but the information available to the automatically by "terraform init", but the information available to the

View File

@ -329,7 +329,7 @@ func (c *ProvidersMirrorCommand) Run(args []string) int {
func (c *ProvidersMirrorCommand) Help() string { func (c *ProvidersMirrorCommand) Help() string {
return ` return `
Usage: terraform providers mirror [options] <target-dir> Usage: terraform [global options] providers mirror [options] <target-dir>
Populates a local directory with copies of the provider plugins needed for Populates a local directory with copies of the provider plugins needed for
the current configuration, so that the directory can be used either directly the current configuration, so that the directory can be used either directly

View File

@ -108,7 +108,7 @@ func (c *ProvidersSchemaCommand) Run(args []string) int {
} }
const providersSchemaCommandHelp = ` const providersSchemaCommandHelp = `
Usage: terraform providers schema -json Usage: terraform [global options] providers schema -json
Prints out a json representation of the schemas for all providers used Prints out a json representation of the schemas for all providers used
in the current configuration. in the current configuration.

View File

@ -23,7 +23,7 @@ func (c *PushCommand) Run(args []string) int {
func (c *PushCommand) Help() string { func (c *PushCommand) Help() string {
helpText := ` helpText := `
Usage: terraform push [options] [DIR] Usage: terraform [global options] push [options] [DIR]
This command was for the legacy version of Terraform Enterprise (v1), which This command was for the legacy version of Terraform Enterprise (v1), which
has now reached end-of-life. Therefore this command is no longer supported. has now reached end-of-life. Therefore this command is no longer supported.

View File

@ -120,7 +120,7 @@ func (c *RefreshCommand) Run(args []string) int {
func (c *RefreshCommand) Help() string { func (c *RefreshCommand) Help() string {
helpText := ` helpText := `
Usage: terraform refresh [options] Usage: terraform [global options] refresh [options]
Update the state file of your infrastructure with metadata that matches Update the state file of your infrastructure with metadata that matches
the physical resources they are tracking. the physical resources they are tracking.

View File

@ -190,7 +190,7 @@ func (c *ShowCommand) Run(args []string) int {
func (c *ShowCommand) Help() string { func (c *ShowCommand) Help() string {
helpText := ` helpText := `
Usage: terraform show [options] [path] Usage: terraform [global options] show [options] [path]
Reads and outputs a Terraform state or plan file in a human-readable Reads and outputs a Terraform state or plan file in a human-readable
form. If no path is specified, the current state will be shown. form. If no path is specified, the current state will be shown.

View File

@ -18,7 +18,7 @@ func (c *StateCommand) Run(args []string) int {
func (c *StateCommand) Help() string { func (c *StateCommand) Help() string {
helpText := ` helpText := `
Usage: terraform state <subcommand> [options] [args] Usage: terraform [global options] state <subcommand> [options] [args]
This command has subcommands for advanced state management. This command has subcommands for advanced state management.

View File

@ -92,7 +92,7 @@ func (c *StateListCommand) Run(args []string) int {
func (c *StateListCommand) Help() string { func (c *StateListCommand) Help() string {
helpText := ` helpText := `
Usage: terraform state list [options] [address...] Usage: terraform [global options] state list [options] [address...]
List resources in the Terraform state. List resources in the Terraform state.

View File

@ -454,7 +454,7 @@ func (c *StateMvCommand) validateResourceMove(addrFrom, addrTo addrs.AbsResource
func (c *StateMvCommand) Help() string { func (c *StateMvCommand) Help() string {
helpText := ` helpText := `
Usage: terraform state mv [options] SOURCE DESTINATION Usage: terraform [global options] state mv [options] SOURCE DESTINATION
This command will move an item matched by the address given to the This command will move an item matched by the address given to the
destination address. This command can also move to a destination address destination address. This command can also move to a destination address

View File

@ -68,7 +68,7 @@ func (c *StatePullCommand) Run(args []string) int {
func (c *StatePullCommand) Help() string { func (c *StatePullCommand) Help() string {
helpText := ` helpText := `
Usage: terraform state pull [options] Usage: terraform [global options] state pull [options]
Pull the state from its location, upgrade the local copy, and output it Pull the state from its location, upgrade the local copy, and output it
to stdout. to stdout.

View File

@ -135,7 +135,7 @@ func (c *StatePushCommand) Run(args []string) int {
func (c *StatePushCommand) Help() string { func (c *StatePushCommand) Help() string {
helpText := ` helpText := `
Usage: terraform state push [options] PATH Usage: terraform [global options] state push [options] PATH
Update remote state from a local state file at PATH. Update remote state from a local state file at PATH.

View File

@ -171,7 +171,7 @@ func (c *StateReplaceProviderCommand) Run(args []string) int {
func (c *StateReplaceProviderCommand) Help() string { func (c *StateReplaceProviderCommand) Help() string {
helpText := ` helpText := `
Usage: terraform state replace-provider [options] FROM_PROVIDER_FQN TO_PROVIDER_FQN Usage: terraform [global options] state replace-provider [options] FROM_PROVIDER_FQN TO_PROVIDER_FQN
Replace provider for resources in the Terraform state. Replace provider for resources in the Terraform state.

View File

@ -285,7 +285,7 @@ func TestStateReplaceProvider(t *testing.T) {
func TestStateReplaceProvider_docs(t *testing.T) { func TestStateReplaceProvider_docs(t *testing.T) {
c := &StateReplaceProviderCommand{} c := &StateReplaceProviderCommand{}
if got, want := c.Help(), "Usage: terraform state replace-provider"; !strings.Contains(got, want) { if got, want := c.Help(), "Usage: terraform [global options] state replace-provider"; !strings.Contains(got, want) {
t.Fatalf("unexpected help text\nwant: %s\nfull output:\n%s", want, got) t.Fatalf("unexpected help text\nwant: %s\nfull output:\n%s", want, got)
} }

View File

@ -134,7 +134,7 @@ func (c *StateRmCommand) Run(args []string) int {
func (c *StateRmCommand) Help() string { func (c *StateRmCommand) Help() string {
helpText := ` helpText := `
Usage: terraform state rm [options] ADDRESS... Usage: terraform [global options] state rm [options] ADDRESS...
Remove one or more items from the Terraform state, causing Terraform to Remove one or more items from the Terraform state, causing Terraform to
"forget" those items without first destroying them in the remote system. "forget" those items without first destroying them in the remote system.

View File

@ -145,7 +145,7 @@ func (c *StateShowCommand) Run(args []string) int {
func (c *StateShowCommand) Help() string { func (c *StateShowCommand) Help() string {
helpText := ` helpText := `
Usage: terraform state show [options] ADDRESS Usage: terraform [global options] state show [options] ADDRESS
Shows the attributes of a resource in the Terraform state. Shows the attributes of a resource in the Terraform state.

View File

@ -207,7 +207,7 @@ func (c *TaintCommand) Run(args []string) int {
func (c *TaintCommand) Help() string { func (c *TaintCommand) Help() string {
helpText := ` helpText := `
Usage: terraform taint [options] <address> Usage: terraform [global options] taint [options] <address>
Terraform uses the term "tainted" to describe a resource instance Terraform uses the term "tainted" to describe a resource instance
which may not be fully functional, either because its creation which may not be fully functional, either because its creation

View File

@ -116,7 +116,7 @@ func (c *UnlockCommand) Run(args []string) int {
func (c *UnlockCommand) Help() string { func (c *UnlockCommand) Help() string {
helpText := ` helpText := `
Usage: terraform force-unlock LOCK_ID Usage: terraform [global options] force-unlock LOCK_ID
Manually unlock the state for the defined configuration. Manually unlock the state for the defined configuration.

View File

@ -181,7 +181,7 @@ func (c *UntaintCommand) Run(args []string) int {
func (c *UntaintCommand) Help() string { func (c *UntaintCommand) Help() string {
helpText := ` helpText := `
Usage: terraform untaint [options] name Usage: terraform [global options] untaint [options] name
Terraform uses the term "tainted" to describe a resource instance Terraform uses the term "tainted" to describe a resource instance
which may not be fully functional, either because its creation which may not be fully functional, either because its creation

View File

@ -240,7 +240,7 @@ func (c *ValidateCommand) Synopsis() string {
func (c *ValidateCommand) Help() string { func (c *ValidateCommand) Help() string {
helpText := ` helpText := `
Usage: terraform validate [options] [dir] Usage: terraform [global options] validate [options] [dir]
Validate the configuration files in a directory, referring only to the Validate the configuration files in a directory, referring only to the
configuration and not accessing any remote services such as remote state, configuration and not accessing any remote services such as remote state,

View File

@ -44,7 +44,7 @@ type VersionCheckInfo struct {
func (c *VersionCommand) Help() string { func (c *VersionCommand) Help() string {
helpText := ` helpText := `
Usage: terraform version [options] Usage: terraform [global options] version [options]
Displays the version of Terraform and all installed plugins Displays the version of Terraform and all installed plugins

View File

@ -27,7 +27,7 @@ func (c *WorkspaceCommand) Run(args []string) int {
func (c *WorkspaceCommand) Help() string { func (c *WorkspaceCommand) Help() string {
helpText := ` helpText := `
Usage: terraform workspace Usage: terraform [global options] workspace
new, list, show, select and delete Terraform workspaces. new, list, show, select and delete Terraform workspaces.

View File

@ -183,7 +183,7 @@ func (c *WorkspaceDeleteCommand) AutocompleteFlags() complete.Flags {
func (c *WorkspaceDeleteCommand) Help() string { func (c *WorkspaceDeleteCommand) Help() string {
helpText := ` helpText := `
Usage: terraform workspace delete [OPTIONS] NAME Usage: terraform [global options] workspace delete [OPTIONS] NAME
Delete a Terraform workspace Delete a Terraform workspace

View File

@ -91,7 +91,7 @@ func (c *WorkspaceListCommand) AutocompleteFlags() complete.Flags {
func (c *WorkspaceListCommand) Help() string { func (c *WorkspaceListCommand) Help() string {
helpText := ` helpText := `
Usage: terraform workspace list Usage: terraform [global options] workspace list
List Terraform workspaces. List Terraform workspaces.

View File

@ -181,7 +181,7 @@ func (c *WorkspaceNewCommand) AutocompleteFlags() complete.Flags {
func (c *WorkspaceNewCommand) Help() string { func (c *WorkspaceNewCommand) Help() string {
helpText := ` helpText := `
Usage: terraform workspace new [OPTIONS] NAME Usage: terraform [global options] workspace new [OPTIONS] NAME
Create a new Terraform workspace. Create a new Terraform workspace.

View File

@ -129,7 +129,7 @@ func (c *WorkspaceSelectCommand) AutocompleteFlags() complete.Flags {
func (c *WorkspaceSelectCommand) Help() string { func (c *WorkspaceSelectCommand) Help() string {
helpText := ` helpText := `
Usage: terraform workspace select NAME Usage: terraform [global options] workspace select NAME
Select a different Terraform workspace. Select a different Terraform workspace.

View File

@ -40,7 +40,7 @@ func (c *WorkspaceShowCommand) AutocompleteFlags() complete.Flags {
func (c *WorkspaceShowCommand) Help() string { func (c *WorkspaceShowCommand) Help() string {
helpText := ` helpText := `
Usage: terraform workspace show Usage: terraform [global options] workspace show
Show the name of the current workspace. Show the name of the current workspace.
` `