From 94340b5940cce89ad4136e63f333986d4996c386 Mon Sep 17 00:00:00 2001 From: Alisdair McDiarmid Date: Mon, 22 Feb 2021 09:25:56 -0500 Subject: [PATCH] cli: Add reference to global options to help text --- command/apply.go | 4 ++-- command/console.go | 2 +- command/fmt.go | 2 +- command/get.go | 2 +- command/graph.go | 2 +- command/import.go | 2 +- command/init.go | 2 +- command/login.go | 2 +- command/logout.go | 2 +- command/output.go | 2 +- command/plan.go | 2 +- command/providers.go | 2 +- command/providers_lock.go | 2 +- command/providers_mirror.go | 2 +- command/providers_schema.go | 2 +- command/push.go | 2 +- command/refresh.go | 2 +- command/show.go | 2 +- command/state_command.go | 2 +- command/state_list.go | 2 +- command/state_mv.go | 2 +- command/state_pull.go | 2 +- command/state_push.go | 2 +- command/state_replace_provider.go | 2 +- command/state_replace_provider_test.go | 2 +- command/state_rm.go | 2 +- command/state_show.go | 2 +- command/taint.go | 2 +- command/unlock.go | 2 +- command/untaint.go | 2 +- command/validate.go | 2 +- command/version.go | 2 +- command/workspace_command.go | 2 +- command/workspace_delete.go | 2 +- command/workspace_list.go | 2 +- command/workspace_new.go | 2 +- command/workspace_select.go | 2 +- command/workspace_show.go | 2 +- 38 files changed, 39 insertions(+), 39 deletions(-) diff --git a/command/apply.go b/command/apply.go index 9ddb6fd98..9996c5a9f 100644 --- a/command/apply.go +++ b/command/apply.go @@ -261,7 +261,7 @@ func (c *ApplyCommand) Synopsis() string { func (c *ApplyCommand) helpApply() string { helpText := ` -Usage: terraform apply [options] [PLAN] +Usage: terraform [global options] apply [options] [PLAN] Creates or updates infrastructure according to Terraform configuration files in the current directory. @@ -323,7 +323,7 @@ Options: func (c *ApplyCommand) helpDestroy() string { helpText := ` -Usage: terraform destroy [options] +Usage: terraform [global options] destroy [options] Destroy Terraform-managed infrastructure. diff --git a/command/console.go b/command/console.go index 98cbb8bd0..ace570f2b 100644 --- a/command/console.go +++ b/command/console.go @@ -175,7 +175,7 @@ func (c *ConsoleCommand) modePiped(session *repl.Session, ui cli.Ui) int { func (c *ConsoleCommand) Help() string { helpText := ` -Usage: terraform console [options] +Usage: terraform [global options] console [options] Starts an interactive console for experimenting with Terraform interpolations. diff --git a/command/fmt.go b/command/fmt.go index ff59d2b9d..09c7ea740 100644 --- a/command/fmt.go +++ b/command/fmt.go @@ -494,7 +494,7 @@ func (c *FmtCommand) trimNewlines(tokens hclwrite.Tokens) hclwrite.Tokens { func (c *FmtCommand) Help() string { helpText := ` -Usage: terraform fmt [options] [DIR] +Usage: terraform [global options] fmt [options] [DIR] Rewrites all Terraform configuration files to a canonical format. Both configuration files (.tf) and variables files (.tfvars) are updated. diff --git a/command/get.go b/command/get.go index 49cb207c3..238f3ec27 100644 --- a/command/get.go +++ b/command/get.go @@ -44,7 +44,7 @@ func (c *GetCommand) Run(args []string) int { func (c *GetCommand) Help() string { helpText := ` -Usage: terraform get [options] PATH +Usage: terraform [global options] get [options] PATH Downloads and installs modules needed for the configuration given by PATH. diff --git a/command/graph.go b/command/graph.go index dfc1a2f8e..2144fd2b6 100644 --- a/command/graph.go +++ b/command/graph.go @@ -163,7 +163,7 @@ func (c *GraphCommand) Run(args []string) int { func (c *GraphCommand) Help() string { helpText := ` -Usage: terraform graph [options] +Usage: terraform [global options] graph [options] Outputs the visual execution graph of Terraform resources according to either the current configuration or an execution plan. diff --git a/command/import.go b/command/import.go index e94907eff..c3adb5291 100644 --- a/command/import.go +++ b/command/import.go @@ -271,7 +271,7 @@ func (c *ImportCommand) Run(args []string) int { func (c *ImportCommand) Help() string { helpText := ` -Usage: terraform import [options] ADDR ID +Usage: terraform [global options] import [options] ADDR ID Import existing infrastructure into your Terraform state. diff --git a/command/init.go b/command/init.go index 414d80d5a..d9726ff5f 100644 --- a/command/init.go +++ b/command/init.go @@ -909,7 +909,7 @@ func (c *InitCommand) AutocompleteFlags() complete.Flags { func (c *InitCommand) Help() string { helpText := ` -Usage: terraform init [options] +Usage: terraform [global options] init [options] Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc. diff --git a/command/login.go b/command/login.go index c249fd22f..828eee74a 100644 --- a/command/login.go +++ b/command/login.go @@ -249,7 +249,7 @@ func (c *LoginCommand) Help() string { } helpText := fmt.Sprintf(` -Usage: terraform login [hostname] +Usage: terraform [global options] login [hostname] Retrieves an authentication token for the given hostname, if it supports automatic login, and saves it in a credentials file in your home directory. diff --git a/command/logout.go b/command/logout.go index 8e30be987..5f2af1104 100644 --- a/command/logout.go +++ b/command/logout.go @@ -132,7 +132,7 @@ func (c *LogoutCommand) Help() string { } helpText := ` -Usage: terraform logout [hostname] +Usage: terraform [global options] logout [hostname] Removes locally-stored credentials for specified hostname. diff --git a/command/output.go b/command/output.go index 52e4b942a..c228bf377 100644 --- a/command/output.go +++ b/command/output.go @@ -97,7 +97,7 @@ func (c *OutputCommand) Outputs(statePath string) (map[string]*states.OutputValu func (c *OutputCommand) Help() string { helpText := ` -Usage: terraform output [options] [NAME] +Usage: terraform [global options] output [options] [NAME] Reads an output variable from a Terraform state file and prints the value. With no additional arguments, output will display all diff --git a/command/plan.go b/command/plan.go index e7695333f..e28b70bb5 100644 --- a/command/plan.go +++ b/command/plan.go @@ -187,7 +187,7 @@ func (c *PlanCommand) Run(args []string) int { func (c *PlanCommand) Help() string { helpText := ` -Usage: terraform plan [options] +Usage: terraform [global options] plan [options] Generates a speculative execution plan, showing what actions Terraform would take to apply the current configuration. This command will not diff --git a/command/providers.go b/command/providers.go index da97ae158..a846b85dc 100644 --- a/command/providers.go +++ b/command/providers.go @@ -149,7 +149,7 @@ func (c *ProvidersCommand) populateTreeNode(tree treeprint.Tree, node *configs.M } const providersCommandHelp = ` -Usage: terraform providers [dir] +Usage: terraform [global options] providers [dir] Prints out a tree of modules in the referenced configuration annotated with their provider requirements. diff --git a/command/providers_lock.go b/command/providers_lock.go index 74f23cef0..1c8d3ae2a 100644 --- a/command/providers_lock.go +++ b/command/providers_lock.go @@ -301,7 +301,7 @@ func (c *ProvidersLockCommand) Run(args []string) int { func (c *ProvidersLockCommand) Help() string { 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 automatically by "terraform init", but the information available to the diff --git a/command/providers_mirror.go b/command/providers_mirror.go index a2367707a..3922840e0 100644 --- a/command/providers_mirror.go +++ b/command/providers_mirror.go @@ -329,7 +329,7 @@ func (c *ProvidersMirrorCommand) Run(args []string) int { func (c *ProvidersMirrorCommand) Help() string { return ` -Usage: terraform providers mirror [options] +Usage: terraform [global options] providers mirror [options] Populates a local directory with copies of the provider plugins needed for the current configuration, so that the directory can be used either directly diff --git a/command/providers_schema.go b/command/providers_schema.go index 3584be9f4..287af436a 100644 --- a/command/providers_schema.go +++ b/command/providers_schema.go @@ -108,7 +108,7 @@ func (c *ProvidersSchemaCommand) Run(args []string) int { } 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 in the current configuration. diff --git a/command/push.go b/command/push.go index 45be43d62..27e6d6051 100644 --- a/command/push.go +++ b/command/push.go @@ -23,7 +23,7 @@ func (c *PushCommand) Run(args []string) int { func (c *PushCommand) Help() string { 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 has now reached end-of-life. Therefore this command is no longer supported. diff --git a/command/refresh.go b/command/refresh.go index ebd609b01..2319df2cd 100644 --- a/command/refresh.go +++ b/command/refresh.go @@ -120,7 +120,7 @@ func (c *RefreshCommand) Run(args []string) int { func (c *RefreshCommand) Help() string { helpText := ` -Usage: terraform refresh [options] +Usage: terraform [global options] refresh [options] Update the state file of your infrastructure with metadata that matches the physical resources they are tracking. diff --git a/command/show.go b/command/show.go index a7ddcb2de..ccccd8b74 100644 --- a/command/show.go +++ b/command/show.go @@ -190,7 +190,7 @@ func (c *ShowCommand) Run(args []string) int { func (c *ShowCommand) Help() string { 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 form. If no path is specified, the current state will be shown. diff --git a/command/state_command.go b/command/state_command.go index 7e3a6af1b..5e7915b67 100644 --- a/command/state_command.go +++ b/command/state_command.go @@ -18,7 +18,7 @@ func (c *StateCommand) Run(args []string) int { func (c *StateCommand) Help() string { helpText := ` -Usage: terraform state [options] [args] +Usage: terraform [global options] state [options] [args] This command has subcommands for advanced state management. diff --git a/command/state_list.go b/command/state_list.go index 5362ebf37..5e2f2527c 100644 --- a/command/state_list.go +++ b/command/state_list.go @@ -92,7 +92,7 @@ func (c *StateListCommand) Run(args []string) int { func (c *StateListCommand) Help() string { helpText := ` -Usage: terraform state list [options] [address...] +Usage: terraform [global options] state list [options] [address...] List resources in the Terraform state. diff --git a/command/state_mv.go b/command/state_mv.go index 8b432a48a..6691aad30 100644 --- a/command/state_mv.go +++ b/command/state_mv.go @@ -454,7 +454,7 @@ func (c *StateMvCommand) validateResourceMove(addrFrom, addrTo addrs.AbsResource func (c *StateMvCommand) Help() string { 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 destination address. This command can also move to a destination address diff --git a/command/state_pull.go b/command/state_pull.go index f2f368348..503e5de16 100644 --- a/command/state_pull.go +++ b/command/state_pull.go @@ -68,7 +68,7 @@ func (c *StatePullCommand) Run(args []string) int { func (c *StatePullCommand) Help() string { 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 to stdout. diff --git a/command/state_push.go b/command/state_push.go index 4fb9194ee..dcffa092e 100644 --- a/command/state_push.go +++ b/command/state_push.go @@ -135,7 +135,7 @@ func (c *StatePushCommand) Run(args []string) int { func (c *StatePushCommand) Help() string { 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. diff --git a/command/state_replace_provider.go b/command/state_replace_provider.go index d8d7d3d70..2397f7d66 100644 --- a/command/state_replace_provider.go +++ b/command/state_replace_provider.go @@ -171,7 +171,7 @@ func (c *StateReplaceProviderCommand) Run(args []string) int { func (c *StateReplaceProviderCommand) Help() string { 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. diff --git a/command/state_replace_provider_test.go b/command/state_replace_provider_test.go index fa3c8505d..7b471af2f 100644 --- a/command/state_replace_provider_test.go +++ b/command/state_replace_provider_test.go @@ -285,7 +285,7 @@ func TestStateReplaceProvider(t *testing.T) { func TestStateReplaceProvider_docs(t *testing.T) { 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) } diff --git a/command/state_rm.go b/command/state_rm.go index 2beeca63e..8c236a74e 100644 --- a/command/state_rm.go +++ b/command/state_rm.go @@ -134,7 +134,7 @@ func (c *StateRmCommand) Run(args []string) int { func (c *StateRmCommand) Help() string { 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 "forget" those items without first destroying them in the remote system. diff --git a/command/state_show.go b/command/state_show.go index 04569d673..ee018cc55 100644 --- a/command/state_show.go +++ b/command/state_show.go @@ -145,7 +145,7 @@ func (c *StateShowCommand) Run(args []string) int { func (c *StateShowCommand) Help() string { 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. diff --git a/command/taint.go b/command/taint.go index 4367c303c..aef940db4 100644 --- a/command/taint.go +++ b/command/taint.go @@ -207,7 +207,7 @@ func (c *TaintCommand) Run(args []string) int { func (c *TaintCommand) Help() string { helpText := ` -Usage: terraform taint [options]
+Usage: terraform [global options] taint [options]
Terraform uses the term "tainted" to describe a resource instance which may not be fully functional, either because its creation diff --git a/command/unlock.go b/command/unlock.go index fd4b4f36b..ce8d43606 100644 --- a/command/unlock.go +++ b/command/unlock.go @@ -116,7 +116,7 @@ func (c *UnlockCommand) Run(args []string) int { func (c *UnlockCommand) Help() string { helpText := ` -Usage: terraform force-unlock LOCK_ID +Usage: terraform [global options] force-unlock LOCK_ID Manually unlock the state for the defined configuration. diff --git a/command/untaint.go b/command/untaint.go index 610fd4750..9b398f140 100644 --- a/command/untaint.go +++ b/command/untaint.go @@ -181,7 +181,7 @@ func (c *UntaintCommand) Run(args []string) int { func (c *UntaintCommand) Help() string { helpText := ` -Usage: terraform untaint [options] name +Usage: terraform [global options] untaint [options] name Terraform uses the term "tainted" to describe a resource instance which may not be fully functional, either because its creation diff --git a/command/validate.go b/command/validate.go index 687bbb8c8..7af8bdbe1 100644 --- a/command/validate.go +++ b/command/validate.go @@ -240,7 +240,7 @@ func (c *ValidateCommand) Synopsis() string { func (c *ValidateCommand) Help() string { helpText := ` -Usage: terraform validate [options] [dir] +Usage: terraform [global options] validate [options] [dir] Validate the configuration files in a directory, referring only to the configuration and not accessing any remote services such as remote state, diff --git a/command/version.go b/command/version.go index 27dbbff43..414a42a34 100644 --- a/command/version.go +++ b/command/version.go @@ -44,7 +44,7 @@ type VersionCheckInfo struct { func (c *VersionCommand) Help() string { helpText := ` -Usage: terraform version [options] +Usage: terraform [global options] version [options] Displays the version of Terraform and all installed plugins diff --git a/command/workspace_command.go b/command/workspace_command.go index 443884e6d..993b2a878 100644 --- a/command/workspace_command.go +++ b/command/workspace_command.go @@ -27,7 +27,7 @@ func (c *WorkspaceCommand) Run(args []string) int { func (c *WorkspaceCommand) Help() string { helpText := ` -Usage: terraform workspace +Usage: terraform [global options] workspace new, list, show, select and delete Terraform workspaces. diff --git a/command/workspace_delete.go b/command/workspace_delete.go index 675795cec..0fb90c429 100644 --- a/command/workspace_delete.go +++ b/command/workspace_delete.go @@ -183,7 +183,7 @@ func (c *WorkspaceDeleteCommand) AutocompleteFlags() complete.Flags { func (c *WorkspaceDeleteCommand) Help() string { helpText := ` -Usage: terraform workspace delete [OPTIONS] NAME +Usage: terraform [global options] workspace delete [OPTIONS] NAME Delete a Terraform workspace diff --git a/command/workspace_list.go b/command/workspace_list.go index 51c345ed6..dda891d4e 100644 --- a/command/workspace_list.go +++ b/command/workspace_list.go @@ -91,7 +91,7 @@ func (c *WorkspaceListCommand) AutocompleteFlags() complete.Flags { func (c *WorkspaceListCommand) Help() string { helpText := ` -Usage: terraform workspace list +Usage: terraform [global options] workspace list List Terraform workspaces. diff --git a/command/workspace_new.go b/command/workspace_new.go index 051220939..ce074d662 100644 --- a/command/workspace_new.go +++ b/command/workspace_new.go @@ -181,7 +181,7 @@ func (c *WorkspaceNewCommand) AutocompleteFlags() complete.Flags { func (c *WorkspaceNewCommand) Help() string { helpText := ` -Usage: terraform workspace new [OPTIONS] NAME +Usage: terraform [global options] workspace new [OPTIONS] NAME Create a new Terraform workspace. diff --git a/command/workspace_select.go b/command/workspace_select.go index 801853bdb..db0d67b96 100644 --- a/command/workspace_select.go +++ b/command/workspace_select.go @@ -129,7 +129,7 @@ func (c *WorkspaceSelectCommand) AutocompleteFlags() complete.Flags { func (c *WorkspaceSelectCommand) Help() string { helpText := ` -Usage: terraform workspace select NAME +Usage: terraform [global options] workspace select NAME Select a different Terraform workspace. diff --git a/command/workspace_show.go b/command/workspace_show.go index 23d438c56..f1f372e86 100644 --- a/command/workspace_show.go +++ b/command/workspace_show.go @@ -40,7 +40,7 @@ func (c *WorkspaceShowCommand) AutocompleteFlags() complete.Flags { func (c *WorkspaceShowCommand) Help() string { helpText := ` -Usage: terraform workspace show +Usage: terraform [global options] workspace show Show the name of the current workspace. `