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