github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/command/state_command.go (about) 1 // Copyright (c) HashiCorp, Inc. 2 // SPDX-License-Identifier: MPL-2.0 3 4 package command 5 6 import ( 7 "strings" 8 9 "github.com/mitchellh/cli" 10 ) 11 12 // StateCommand is a Command implementation that just shows help for 13 // the subcommands nested below it. 14 type StateCommand struct { 15 StateMeta 16 } 17 18 func (c *StateCommand) Run(args []string) int { 19 return cli.RunResultHelp 20 } 21 22 func (c *StateCommand) Help() string { 23 helpText := ` 24 Usage: terraform [global options] state <subcommand> [options] [args] 25 26 This command has subcommands for advanced state management. 27 28 These subcommands can be used to slice and dice the Terraform state. 29 This is sometimes necessary in advanced cases. For your safety, all 30 state management commands that modify the state create a timestamped 31 backup of the state prior to making modifications. 32 33 The structure and output of the commands is specifically tailored to work 34 well with the common Unix utilities such as grep, awk, etc. We recommend 35 using those tools to perform more advanced state tasks. 36 37 ` 38 return strings.TrimSpace(helpText) 39 } 40 41 func (c *StateCommand) Synopsis() string { 42 return "Advanced state management" 43 }