command/push: accept -vcs

This commit is contained in:
Mitchell Hashimoto 2015-03-24 17:03:59 -07:00
parent 20a81a9d05
commit 395dd04861
2 changed files with 11 additions and 2 deletions

View File

@ -22,7 +22,7 @@ type PushCommand struct {
func (c *PushCommand) Run(args []string) int { func (c *PushCommand) Run(args []string) int {
var atlasToken string var atlasToken string
var moduleUpload bool var archiveVCS, moduleUpload bool
var name string var name string
args = c.Meta.process(args, false) args = c.Meta.process(args, false)
cmdFlags := c.Meta.flagSet("push") cmdFlags := c.Meta.flagSet("push")
@ -30,6 +30,7 @@ func (c *PushCommand) Run(args []string) int {
cmdFlags.StringVar(&atlasToken, "token", "", "") cmdFlags.StringVar(&atlasToken, "token", "", "")
cmdFlags.BoolVar(&moduleUpload, "module-upload", true, "") cmdFlags.BoolVar(&moduleUpload, "module-upload", true, "")
cmdFlags.StringVar(&name, "name", "", "") cmdFlags.StringVar(&name, "name", "", "")
cmdFlags.BoolVar(&archiveVCS, "vcs", true, "")
cmdFlags.Usage = func() { c.Ui.Error(c.Help()) } cmdFlags.Usage = func() { c.Ui.Error(c.Help()) }
if err := cmdFlags.Parse(args); err != nil { if err := cmdFlags.Parse(args); err != nil {
return 1 return 1
@ -136,7 +137,7 @@ func (c *PushCommand) Run(args []string) int {
// Build the archiving options, which includes everything it can // Build the archiving options, which includes everything it can
// by default according to VCS rules but forcing the data directory. // by default according to VCS rules but forcing the data directory.
archiveOpts := &archive.ArchiveOpts{ archiveOpts := &archive.ArchiveOpts{
VCS: true, VCS: archiveVCS,
Extra: map[string]string{ Extra: map[string]string{
DefaultDataDir: c.DataDir(), DefaultDataDir: c.DataDir(),
}, },
@ -195,6 +196,9 @@ Options:
-token=<token> Access token to use to upload. If blank, the ATLAS_TOKEN -token=<token> Access token to use to upload. If blank, the ATLAS_TOKEN
environmental variable will be used. environmental variable will be used.
-vcs=true If true (default), push will upload only files
comitted to your VCS, if detected.
` `
return strings.TrimSpace(helpText) return strings.TrimSpace(helpText)
} }

View File

@ -52,6 +52,11 @@ The command-line flags are all optional. The list of available flags are:
* `-token=<token>` - Atlas API token to use to authorize the upload. * `-token=<token>` - Atlas API token to use to authorize the upload.
If blank, the `ATLAS_TOKEN` environmental variable will be used. If blank, the `ATLAS_TOKEN` environmental variable will be used.
* `-vcs=true` - If true (default), then Terraform will detect if a VCS
is in use, such as Git, and will only upload files that are comitted to
version control. If no version control system is detected, Terraform will
upload all files in `path` (parameter to the command).
## Packaged Files ## Packaged Files
The files that are uploaded and packaged with a `push` are all the The files that are uploaded and packaged with a `push` are all the