-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
command: "terraform workspace show" to print current workspace name
- Loading branch information
1 parent
da1c45b
commit 8443b51
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package command | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
type EnvShowCommand struct { | ||
Meta | ||
} | ||
|
||
func (c *EnvShowCommand) Run(args []string) int { | ||
args = c.Meta.process(args, true) | ||
|
||
cmdFlags := c.Meta.flagSet("env show") | ||
cmdFlags.Usage = func() { c.Ui.Error(c.Help()) } | ||
if err := cmdFlags.Parse(args); err != nil { | ||
return 1 | ||
} | ||
|
||
env := c.Env() | ||
c.Ui.Output( | ||
c.Colorize().Color( | ||
fmt.Sprintf(env), | ||
), | ||
) | ||
|
||
return 1 | ||
} | ||
|
||
func (c *EnvShowCommand) Help() string { | ||
helpText := ` | ||
Usage: terraform env show | ||
Show current Terraform environment. | ||
` | ||
return strings.TrimSpace(helpText) | ||
} | ||
|
||
func (c *EnvShowCommand) Synopsis() string { | ||
return "Show current Terraform environment" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters