2017-06-26 23:46:34 +02:00
|
|
|
// Copyright 2016-2017, Pulumi Corporation. All rights reserved.
|
2017-02-13 23:26:46 +01:00
|
|
|
|
2017-09-22 04:18:21 +02:00
|
|
|
package cmd
|
2017-02-13 23:26:46 +01:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
2017-09-22 04:18:21 +02:00
|
|
|
"github.com/pulumi/pulumi/pkg/util/cmdutil"
|
2017-02-13 23:26:46 +01:00
|
|
|
)
|
|
|
|
|
2017-03-06 15:32:39 +01:00
|
|
|
func newEnvCmd() *cobra.Command {
|
2017-06-16 18:46:09 +02:00
|
|
|
var showIDs bool
|
|
|
|
var showURNs bool
|
2017-02-26 20:20:14 +01:00
|
|
|
cmd := &cobra.Command{
|
2017-03-06 15:32:39 +01:00
|
|
|
Use: "env",
|
2017-03-10 22:17:55 +01:00
|
|
|
Short: "Manage target environments",
|
|
|
|
Long: "Manage target environments\n" +
|
2017-02-26 20:20:14 +01:00
|
|
|
"\n" +
|
2017-03-10 22:17:55 +01:00
|
|
|
"An environment is a named deployment target, and a single project may have many of them.\n" +
|
|
|
|
"Each environment has a configuration and deployment history associated with it, stored in\n" +
|
|
|
|
"the workspace, in addition to a full checkpoint of the last known good deployment.\n",
|
2017-06-16 18:46:09 +02:00
|
|
|
Run: cmdutil.RunFunc(func(cmd *cobra.Command, args []string) error {
|
2017-08-23 19:58:35 +02:00
|
|
|
return lumiEngine.EnvInfo(showIDs, showURNs)
|
2017-06-16 18:46:09 +02:00
|
|
|
}),
|
2017-02-26 20:20:14 +01:00
|
|
|
}
|
|
|
|
|
2017-06-16 18:46:09 +02:00
|
|
|
cmd.PersistentFlags().BoolVarP(
|
|
|
|
&showIDs, "show-ids", "i", false, "Display each resource's provider-assigned unique ID")
|
|
|
|
cmd.PersistentFlags().BoolVarP(
|
2017-09-22 04:18:21 +02:00
|
|
|
&showURNs, "show-urns", "u", false, "Display each resource's Pulumi-assigned globally unique URN")
|
2017-06-16 18:46:09 +02:00
|
|
|
|
2017-03-06 15:32:39 +01:00
|
|
|
cmd.AddCommand(newEnvInitCmd())
|
|
|
|
cmd.AddCommand(newEnvLsCmd())
|
|
|
|
cmd.AddCommand(newEnvRmCmd())
|
Make major commands more pleasant
This change eliminates the need to constantly type in the environment
name when performing major commands like configuration, planning, and
deployment. It's probably due to my age, however, I keep fat-fingering
simple commands in front of investors and I am embarrassed!
In the new model, there is a notion of a "current environment", and
I have modeled it kinda sorta just like Git's notion of "current branch."
By default, the current environment is set when you `init` something.
Otherwise, there is the `coco env select <env>` command to change it.
(Running this command w/out a new <env> will show you the current one.)
The major commands `config`, `plan`, `deploy`, and `destroy` will prefer
to use the current environment, unless it is overridden by using the
--env flag. All of the `coco env <cmd> <env>` commands still require the
explicit passing of an environment which seems reasonable since they are,
after all, about manipulating environments.
As part of this, I've overhauled the aging workspace settings cruft,
which had fallen into disrepair since the initial prototype.
2017-03-22 03:23:32 +01:00
|
|
|
cmd.AddCommand(newEnvSelectCmd())
|
2017-02-26 20:20:14 +01:00
|
|
|
|
|
|
|
return cmd
|
|
|
|
}
|