@@ -5,21 +5,26 @@ import (
55 "os"
66
77 "github.com/MakeNowJust/heredoc"
8-
98 "github.com/spf13/cobra"
109)
1110
11+ const formatString = "%30v: %s\n "
12+
1213func NewEnvCheckCommand () * cobra.Command {
1314 cmd := & cobra.Command {
1415 Use : "env" ,
1516 Short : "Shows the current profiles configuration properties" ,
16- Example : heredoc .Doc (`
17+ Example : heredoc .Doc (
18+ `
1719 $ cx utils env
18- ` ),
20+ ` ,
21+ ),
1922 Annotations : map [string ]string {
20- "command:doc" : heredoc .Doc (`
23+ "command:doc" : heredoc .Doc (
24+ `
2125 https://checkmarx.atlassian.net/wiki/x/VJGXtw
22- ` ),
26+ ` ,
27+ ),
2328 },
2429 RunE : runEnvChecks (),
2530 }
@@ -29,24 +34,9 @@ func NewEnvCheckCommand() *cobra.Command {
2934func runEnvChecks () func (cmd * cobra.Command , args []string ) error {
3035 return func (cmd * cobra.Command , args []string ) error {
3136 fmt .Printf ("\n Detected Environment Variables:\n \n " )
32- fmt .Printf ("%30v" , "CX_BASE_URI: " )
33- fmt .Println (os .Getenv ("CX_BASE_URI" ))
34- fmt .Printf ("%30v" , "CX_BASE_AUTH_URI: " )
35- fmt .Println (os .Getenv ("CX_BASE_AUTH_URI" ))
36- fmt .Printf ("%30v" , "CX_TENANT: " )
37- fmt .Println (os .Getenv ("CX_TENANT" ))
38- fmt .Printf ("%30v" , "HTTP_PROXY: " )
39- fmt .Println (os .Getenv ("HTTP_PROXY" ))
40- fmt .Printf ("%30v" , "HTTP_PROXY_TYPE: " )
41- fmt .Println (os .Getenv ("CX_PROXY_AUTH_TYPE" ))
42- fmt .Printf ("%30v" , "CX_CLIENT_ID: " )
43- fmt .Println (os .Getenv ("CX_CLIENT_ID" ))
44- fmt .Printf ("%30v" , "CX_CLIENT_SECRET: " )
45- fmt .Println (os .Getenv ("CX_CLIENT_SECRET" ))
46- fmt .Printf ("%30v" , "CX_APIKEY: " )
47- fmt .Println (os .Getenv ("CX_APIKEY" ))
48- fmt .Printf ("%30v" , "CX_BRANCH: " )
49- fmt .Println (os .Getenv ("CX_BRANCH" ))
37+ for param := range properties {
38+ fmt .Printf (formatString , param , os .Getenv (param ))
39+ }
5040 return nil
5141 }
5242}
0 commit comments