github.com/pmcatominey/terraform@v0.7.0-rc2.0.20160708105029-1401a52a5cc5/command/remote.go (about) 1 package command 2 3 import ( 4 "strings" 5 ) 6 7 type RemoteCommand struct { 8 Meta 9 } 10 11 func (c *RemoteCommand) Run(argsRaw []string) int { 12 // Duplicate the args so we can munge them without affecting 13 // future subcommand invocations which will do the same. 14 args := make([]string, len(argsRaw)) 15 copy(args, argsRaw) 16 args = c.Meta.process(args, false) 17 18 if len(args) == 0 { 19 c.Ui.Error(c.Help()) 20 return 1 21 } 22 23 switch args[0] { 24 case "config": 25 cmd := &RemoteConfigCommand{Meta: c.Meta} 26 return cmd.Run(args[1:]) 27 case "pull": 28 cmd := &RemotePullCommand{Meta: c.Meta} 29 return cmd.Run(args[1:]) 30 case "push": 31 cmd := &RemotePushCommand{Meta: c.Meta} 32 return cmd.Run(args[1:]) 33 default: 34 c.Ui.Error(c.Help()) 35 return 1 36 } 37 } 38 39 func (c *RemoteCommand) Help() string { 40 helpText := ` 41 Usage: terraform remote <subcommand> [options] 42 43 Configure remote state storage with Terraform. 44 45 Options: 46 47 -no-color If specified, output won't contain any color. 48 49 Available subcommands: 50 51 config Configure the remote storage settings. 52 pull Sync the remote storage by downloading to local storage. 53 push Sync the remote storage by uploading the local storage. 54 55 ` 56 return strings.TrimSpace(helpText) 57 } 58 59 func (c *RemoteCommand) Synopsis() string { 60 return "Configure remote state storage" 61 }