github.com/sl1pm4t/terraform@v0.6.4-0.20170725213156-870617d22df3/command/workspace_show.go (about)

     1  package command
     2  
     3  import (
     4  	"strings"
     5  )
     6  
     7  type WorkspaceShowCommand struct {
     8  	Meta
     9  }
    10  
    11  func (c *WorkspaceShowCommand) Run(args []string) int {
    12  	args, err := c.Meta.process(args, true)
    13  	if err != nil {
    14  		return 1
    15  	}
    16  
    17  	cmdFlags := c.Meta.flagSet("workspace show")
    18  	cmdFlags.Usage = func() { c.Ui.Error(c.Help()) }
    19  	if err := cmdFlags.Parse(args); err != nil {
    20  		return 1
    21  	}
    22  
    23  	workspace := c.Workspace()
    24  	c.Ui.Output(workspace)
    25  
    26  	return 0
    27  }
    28  
    29  func (c *WorkspaceShowCommand) Help() string {
    30  	helpText := `
    31  Usage: terraform workspace show
    32  
    33    Show the name of the current workspace.
    34  `
    35  	return strings.TrimSpace(helpText)
    36  }
    37  
    38  func (c *WorkspaceShowCommand) Synopsis() string {
    39  	return "Show the name of the current workspace"
    40  }