From cdcd11419ee08678f63f14a9008253e45958b12f Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Sun, 21 Jun 2015 21:51:40 +0100 Subject: [PATCH 1/2] Add -no-color option for subcommands --- command/meta.go | 1 + 1 file changed, 1 insertion(+) diff --git a/command/meta.go b/command/meta.go index 7237a8d61..b469ecb5e 100644 --- a/command/meta.go +++ b/command/meta.go @@ -351,6 +351,7 @@ func (m *Meta) process(args []string, vars bool) []string { for i, v := range args { if v == "-no-color" { m.color = false + m.Color = false args = append(args[:i], args[i+1:]...) break } From b7d41d2eeddfcbedacfa8e3ecc59eefe9d9dd79a Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Mon, 22 Jun 2015 13:14:01 +0100 Subject: [PATCH 2/2] Add -no-color to help text --- command/get.go | 2 ++ command/graph.go | 3 +++ command/init.go | 2 ++ command/output.go | 2 ++ command/plan.go | 1 - command/push.go | 2 ++ command/remote.go | 4 ++++ command/remote_config.go | 2 ++ command/remote_pull.go | 3 +++ command/remote_push.go | 2 ++ 10 files changed, 22 insertions(+), 1 deletion(-) diff --git a/command/get.go b/command/get.go index 1ca3b1305..91d13bbcd 100644 --- a/command/get.go +++ b/command/get.go @@ -77,6 +77,8 @@ Options: -update=false If true, modules already downloaded will be checked for updates and updated if necessary. + -no-color If specified, output won't contain any color. + ` return strings.TrimSpace(helpText) } diff --git a/command/graph.go b/command/graph.go index 802c3c805..5719a8900 100644 --- a/command/graph.go +++ b/command/graph.go @@ -103,6 +103,9 @@ Options: -verbose Generate a verbose, "worst-case" graph, with all nodes for potential operations in place. + + -no-color If specified, output won't contain any color. + ` return strings.TrimSpace(helpText) } diff --git a/command/init.go b/command/init.go index 328c473d0..fb842d08d 100644 --- a/command/init.go +++ b/command/init.go @@ -149,6 +149,8 @@ Options: -backend-config="k=v" Specifies configuration for the remote storage backend. This can be specified multiple times. + -no-color If specified, output won't contain any color. + ` return strings.TrimSpace(helpText) } diff --git a/command/output.go b/command/output.go index 1f48d8877..63a6926f3 100644 --- a/command/output.go +++ b/command/output.go @@ -94,6 +94,8 @@ Options: -state=path Path to the state file to read. Defaults to "terraform.tfstate". + -no-color If specified, output won't contain any color. + ` return strings.TrimSpace(helpText) } diff --git a/command/plan.go b/command/plan.go index 083373c3a..283beba49 100644 --- a/command/plan.go +++ b/command/plan.go @@ -189,7 +189,6 @@ Options: -var-file=foo Set variables in the Terraform configuration from a file. If "terraform.tfvars" is present, it will be automatically loaded if this flag is not specified. - ` return strings.TrimSpace(helpText) } diff --git a/command/push.go b/command/push.go index 80d72c4dc..e3a52e63d 100644 --- a/command/push.go +++ b/command/push.go @@ -221,6 +221,8 @@ Options: -vcs=true If true (default), push will upload only files comitted to your VCS, if detected. + -no-color If specified, output won't contain any color. + ` return strings.TrimSpace(helpText) } diff --git a/command/remote.go b/command/remote.go index 3e9e05f1b..05d119341 100644 --- a/command/remote.go +++ b/command/remote.go @@ -42,6 +42,10 @@ Usage: terraform remote [options] Configure remote state storage with Terraform. +Options: + + -no-color If specified, output won't contain any color. + Available subcommands: config Configure the remote storage settings. diff --git a/command/remote_config.go b/command/remote_config.go index 92017c484..265d1bff4 100644 --- a/command/remote_config.go +++ b/command/remote_config.go @@ -368,6 +368,8 @@ Options: -state=path Path to read state. Defaults to "terraform.tfstate" unless remote state is enabled. + -no-color If specified, output won't contain any color. + ` return strings.TrimSpace(helpText) } diff --git a/command/remote_pull.go b/command/remote_pull.go index bf757ccf1..b159d5a3b 100644 --- a/command/remote_pull.go +++ b/command/remote_pull.go @@ -74,6 +74,9 @@ Usage: terraform pull [options] Refreshes the cached state file from the remote server. +Options: + + -no-color If specified, output won't contain any color. ` return strings.TrimSpace(helpText) } diff --git a/command/remote_push.go b/command/remote_push.go index 81e50c6ba..97ff8f951 100644 --- a/command/remote_push.go +++ b/command/remote_push.go @@ -81,6 +81,8 @@ Usage: terraform push [options] Options: + -no-color If specified, output won't contain any color. + -force Forces the upload of the local state, ignoring any conflicts. This should be used carefully, as force pushing can cause remote state information to be lost.