From 9e99e3ca22c19c06e993c610bcf1649d4e21c28f Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Tue, 3 Mar 2020 15:40:06 +1100 Subject: [PATCH 1/7] initial work on defining config via flag or envvar --- cmd/config.go | 7 ++++--- cmd/login.go | 7 +------ cmd/root.go | 47 ++++++++++++++++++++++++++++++----------------- cmd/ssh.go | 3 +-- go.mod | 2 +- go.sum | 16 ++++++++++++++-- 6 files changed, 51 insertions(+), 31 deletions(-) diff --git a/cmd/config.go b/cmd/config.go index c738b96a..e9d5651e 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "os" + "path/filepath" "reflect" "strings" @@ -58,7 +59,7 @@ var configDefaultCmd = &cobra.Command{ os.Exit(1) } viper.Set("default", strings.TrimSpace(string(lagoonConfig.Lagoon))) - err := viper.WriteConfig() + err := viper.WriteConfigAs(filepath.Join(userPath, configName+configExtension)) handleError(err) resultData := output.Result{ @@ -140,7 +141,7 @@ var configAddCmd = &cobra.Command{ if lagoonConfig.Token != "" { viper.Set("lagoons."+lagoonConfig.Lagoon+".token", lagoonConfig.Token) } - err := viper.WriteConfig() + err := viper.WriteConfigAs(filepath.Join(userPath, configName+configExtension)) if err != nil { output.RenderError(err.Error(), outputOptions) os.Exit(1) @@ -197,7 +198,7 @@ var configFeatureSwitch = &cobra.Command{ case "false": viper.Set("updateCheckDisable", false) } - err := viper.WriteConfig() + err := viper.WriteConfigAs(filepath.Join(userPath, configName+configExtension)) if err != nil { output.RenderError(err.Error(), outputOptions) os.Exit(1) diff --git a/cmd/login.go b/cmd/login.go index 0a0dbd62..f3f98766 100644 --- a/cmd/login.go +++ b/cmd/login.go @@ -64,13 +64,8 @@ func publicKey(path string, skipAgent bool) (ssh.AuthMethod, func() error) { } func loginToken() error { - homeDir, err := os.UserHomeDir() - if err != nil { - return fmt.Errorf("couldn't get $HOME: %v", err) - } skipAgent := false - - privateKey := fmt.Sprintf("%s/.ssh/id_rsa", homeDir) + privateKey := fmt.Sprintf("%s/.ssh/id_rsa", userPath) if cmdSSHKey != "" { privateKey = cmdSSHKey skipAgent = true diff --git a/cmd/root.go b/cmd/root.go index 6a81c6c3..a663d542 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -9,6 +9,7 @@ import ( "strings" "time" + "github.com/amazeeio/lagoon-cli/internal/helpers" "github.com/amazeeio/lagoon-cli/pkg/app" "github.com/amazeeio/lagoon-cli/pkg/graphql" "github.com/amazeeio/lagoon-cli/pkg/lagoon/environments" @@ -31,6 +32,8 @@ var versionFlag bool var docsFlag bool var updateInterval = time.Hour * 24 * 7 // One week interval between updates var configName = ".lagoon" +var configExtension = ".yml" +var userPath string var updateDocURL = "https://amazeeio.github.io/lagoon-cli" var skipUpdateCheck bool @@ -52,12 +55,7 @@ var rootCmd = &cobra.Command{ } if skipUpdateCheck == false { // Using code from https://github.com/drud/ddev/ - home, err := os.UserHomeDir() - if err != nil { - output.RenderError(err.Error(), outputOptions) - os.Exit(1) - } - updateFile := filepath.Join(home, configName+".update") + updateFile := filepath.Join(userPath, ".lagoon.update") // Do periodic detection of whether an update is available for lagoon-cli users. timeToCheckForUpdates, err := updatecheck.IsUpdateNeeded(updateFile, updateInterval) if err != nil { @@ -133,6 +131,10 @@ func init() { rootCmd.PersistentFlags().BoolVarP(&debugEnable, "debug", "", false, "Enable debugging output (if supported)") rootCmd.PersistentFlags().BoolVarP(&skipUpdateCheck, "skip-update-check", "", false, "Skip checking for updates") + // get config-file from flag + rootCmd.PersistentFlags().StringP("config-file", "", "", "Path to the config file you want to use instead of the default (must be .yml or .yaml)") + rootCmd.PersistentFlags().BoolP("create-config", "", false, "Create the config file if it is non existent") + rootCmd.Flags().BoolVarP(&versionFlag, "version", "", false, "Version information") rootCmd.Flags().BoolVarP(&docsFlag, "docs", "", false, "Generate docs") @@ -197,27 +199,38 @@ func displayVersionInfo() { } func initConfig() { + var err error // Find home directory. - home, err := os.UserHomeDir() + userPath, err = os.UserHomeDir() + if err != nil { + output.RenderError(fmt.Errorf("couldn't get $HOME: %v", err).Error(), outputOptions) + os.Exit(1) + } + + // check if we are being given a path to a different config file + err = helpers.GetLagoonConfigFile(&userPath, &configName, &configExtension, rootCmd) if err != nil { output.RenderError(err.Error(), outputOptions) os.Exit(1) } + fmt.Println(userPath, configName) - // Search config in home directory with name ".lagoon" (without extension). + // Search config in userPath directory with default name ".lagoon" (without extension). // @todo see if we can grok the proper info from the cwd .lagoon.yml - viper.AddConfigPath(home) + viper.SetConfigType("yaml") + viper.AddConfigPath(userPath) viper.SetConfigName(configName) - viper.SetDefault("lagoons.amazeeio.hostname", "ssh.lagoon.amazeeio.cloud") - viper.SetDefault("lagoons.amazeeio.port", 32222) - viper.SetDefault("lagoons.amazeeio.token", "") - viper.SetDefault("lagoons.amazeeio.graphql", "https://api.lagoon.amazeeio.cloud/graphql") - viper.SetDefault("lagoons.amazeeio.ui", "https://ui-lagoon-master.ch.amazee.io") - viper.SetDefault("lagoons.amazeeio.kibana", "https://logs-db-ui-lagoon-master.ch.amazee.io/") - viper.SetDefault("default", "amazeeio") err = viper.ReadInConfig() if err != nil { - err = viper.WriteConfigAs(filepath.Join(home, configName+".yml")) + // if we can't read the file cause it doesn't exist, then we should set the default configuration options and try create it + viper.SetDefault("lagoons.amazeeio.hostname", "ssh.lagoon.amazeeio.cloud") + viper.SetDefault("lagoons.amazeeio.port", 32222) + viper.SetDefault("lagoons.amazeeio.token", "") + viper.SetDefault("lagoons.amazeeio.graphql", "https://api.lagoon.amazeeio.cloud/graphql") + viper.SetDefault("lagoons.amazeeio.ui", "https://ui-lagoon-master.ch.amazee.io") + viper.SetDefault("lagoons.amazeeio.kibana", "https://logs-db-ui-lagoon-master.ch.amazee.io/") + viper.SetDefault("default", "amazeeio") + err = viper.WriteConfigAs(filepath.Join(userPath, configName+configExtension)) if err != nil { output.RenderError(err.Error(), outputOptions) os.Exit(1) diff --git a/cmd/ssh.go b/cmd/ssh.go index 8282a9c8..c139a97f 100644 --- a/cmd/ssh.go +++ b/cmd/ssh.go @@ -36,10 +36,9 @@ var sshEnvCmd = &cobra.Command{ fmt.Println(lagoonssh.GenerateSSHConnectionString(sshConfig, sshService, sshContainer)) } else { // get private key that the cli is using - homeDir, _ := os.UserHomeDir() skipAgent := false - privateKey := fmt.Sprintf("%s/.ssh/id_rsa", homeDir) + privateKey := fmt.Sprintf("%s/.ssh/id_rsa", userPath) if cmdSSHKey != "" { privateKey = cmdSSHKey skipAgent = true diff --git a/go.mod b/go.mod index 62dbfe65..b78ccf57 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 github.com/spf13/cobra v0.0.5 github.com/spf13/pflag v1.0.3 - github.com/spf13/viper v1.5.0 + github.com/spf13/viper v1.6.2 golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20191105091915-95d230a53780 // indirect gopkg.in/yaml.v2 v2.2.4 diff --git a/go.sum b/go.sum index f0bf9c6f..412ef885 100644 --- a/go.sum +++ b/go.sum @@ -58,6 +58,8 @@ github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASu github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf h1:7+FW5aGwISbqUtkfmIpZJGRgNFg2ioYPvFaUxdqpDsg= github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf/go.mod h1:RpwtwJQFrIEPstU94h88MWPXP2ektJZ8cZ0YntAmXiE= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gordonklaus/ineffassign v0.0.0-20180909121442-1003c8bd00dc h1:cJlkeAx1QYgO5N80aF5xRGstVsRQwgLR7uA2FnP1ZjY= github.com/gordonklaus/ineffassign v0.0.0-20180909121442-1003c8bd00dc/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= @@ -71,6 +73,8 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/integralist/go-findroot v0.0.0-20160518114804-ac90681525dc h1:4IZpk3M4m6ypx0IlRoEyEyY1gAdicWLMQ0NcG/gBnnA= github.com/integralist/go-findroot v0.0.0-20160518114804-ac90681525dc/go.mod h1:UlaC6ndby46IJz9m/03cZPKKkR9ykeIVBBDE3UDBdJk= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a h1:FaWFmfWdAUKbSCtOU2QjDaorUexogfaMgbipgYATUMU= github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= @@ -133,6 +137,10 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR github.com/shreddedbacon/tablewriter v0.0.2-0.20200114082015-d810c4a558bf h1:4EJ9+fNa+YveELFXQp0S0usSXii8obx3f856uiD7OLk= github.com/shreddedbacon/tablewriter v0.0.2-0.20200114082015-d810c4a558bf/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= @@ -146,8 +154,8 @@ github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb6 github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.5.0 h1:GpsTwfsQ27oS/Aha/6d1oD7tpKIqWnOA6tgOX9HHkt4= -github.com/spf13/viper v1.5.0/go.mod h1:AkYRkVJF8TkSG/xet6PzXX+l39KhhXa2pdqVSxnTcn4= +github.com/spf13/viper v1.6.2 h1:7aKfF+e8/k68gda3LOjo5RxiUqddoFxVq4BKBPrxk5E= +github.com/spf13/viper v1.6.2/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -199,6 +207,8 @@ golang.org/x/tools v0.0.0-20181122213734-04b5d21e00f1/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd h1:/e+gpKk9r3dJobndpTytxS2gOy6m5uvpg+ISQoEcusQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384 h1:TFlARGu6Czu1z7q93HTxcP1P+/ZFC/IKythI5RzrnRg= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -209,6 +219,8 @@ gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20191105091915-95d230a53780/go.mo gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= From fc37f082f722bea646dc8ff1a74fdac9870dae81 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Tue, 3 Mar 2020 15:40:34 +1100 Subject: [PATCH 2/7] initial work on defining config via flag or envvar --- internal/helpers/helpers.go | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 internal/helpers/helpers.go diff --git a/internal/helpers/helpers.go b/internal/helpers/helpers.go new file mode 100644 index 00000000..cb0ea978 --- /dev/null +++ b/internal/helpers/helpers.go @@ -0,0 +1,53 @@ +package helpers + +import ( + "fmt" + "os" + "path/filepath" + "strings" + + "github.com/spf13/cobra" +) + +/* + Place to put any helper functions for the cli +*/ + +// FileExists check if a file exists +func FileExists(filename string) bool { + info, err := os.Stat(filename) + if os.IsNotExist(err) { + return false + } + return !info.IsDir() +} + +// GetLagoonConfigFile . +func GetLagoonConfigFile(userPath *string, configName *string, configExtension *string, cmd *cobra.Command) error { + // check if we have an envvar to define our confg file + var configFilePath string + createConfig, err := cmd.Flags().GetBool("create-config") + if err != nil { + return err + } + if lagoonConfigEnvar, ok := os.LookupEnv("LAGOONCONFIG"); !ok { + configFilePath = lagoonConfigEnvar + } + // otherwise check the flag + configFilePath, err = cmd.Flags().GetString("config-file") + if err != nil { + return err + } + if configFilePath != "" { + if FileExists(configFilePath) || createConfig { + *userPath = filepath.Dir(configFilePath) + *configExtension = filepath.Ext(configFilePath) + *configName = strings.TrimSuffix(filepath.Base(configFilePath), *configExtension) + return nil + } + return fmt.Errorf("%s/%s File doesn't exist", *userPath, configFilePath) + + } + // no config file found + return nil +} From 4107640ecfb61c35cc4e8315b27ebc05778d4908 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Tue, 3 Mar 2020 15:57:10 +1100 Subject: [PATCH 3/7] rework create-config, add docs --- cmd/config.go | 1 + cmd/root.go | 7 +++---- docs/commands/lagoon.md | 1 + docs/commands/lagoon_add.md | 1 + docs/commands/lagoon_add_group.md | 1 + docs/commands/lagoon_add_project-group.md | 1 + docs/commands/lagoon_add_project-rocketchat.md | 1 + docs/commands/lagoon_add_project-slack.md | 1 + docs/commands/lagoon_add_project.md | 1 + docs/commands/lagoon_add_rocketchat.md | 1 + docs/commands/lagoon_add_slack.md | 1 + docs/commands/lagoon_add_user-group.md | 1 + docs/commands/lagoon_add_user-sshkey.md | 1 + docs/commands/lagoon_add_user.md | 1 + docs/commands/lagoon_add_variable.md | 1 + docs/commands/lagoon_config.md | 1 + docs/commands/lagoon_config_add.md | 2 ++ docs/commands/lagoon_config_default.md | 1 + docs/commands/lagoon_config_delete.md | 1 + docs/commands/lagoon_config_feature.md | 1 + docs/commands/lagoon_config_list.md | 1 + docs/commands/lagoon_delete.md | 1 + docs/commands/lagoon_delete_environment.md | 1 + docs/commands/lagoon_delete_group.md | 1 + docs/commands/lagoon_delete_project-group.md | 1 + docs/commands/lagoon_delete_project-rocketchat.md | 1 + docs/commands/lagoon_delete_project-slack.md | 1 + docs/commands/lagoon_delete_project.md | 1 + docs/commands/lagoon_delete_rocketchat.md | 1 + docs/commands/lagoon_delete_slack.md | 1 + docs/commands/lagoon_delete_user-group.md | 1 + docs/commands/lagoon_delete_user-sshkey.md | 1 + docs/commands/lagoon_delete_user.md | 1 + docs/commands/lagoon_delete_variable.md | 1 + docs/commands/lagoon_deploy.md | 1 + docs/commands/lagoon_deploy_branch.md | 1 + docs/commands/lagoon_deploy_promote.md | 1 + docs/commands/lagoon_get.md | 1 + docs/commands/lagoon_get_all-user-sshkeys.md | 1 + docs/commands/lagoon_get_deployment.md | 1 + docs/commands/lagoon_get_environment.md | 1 + docs/commands/lagoon_get_project-key.md | 1 + docs/commands/lagoon_get_project.md | 1 + docs/commands/lagoon_get_user-sshkeys.md | 1 + docs/commands/lagoon_kibana.md | 1 + docs/commands/lagoon_list.md | 1 + docs/commands/lagoon_list_deployments.md | 1 + docs/commands/lagoon_list_environments.md | 1 + docs/commands/lagoon_list_group-projects.md | 1 + docs/commands/lagoon_list_groups.md | 1 + docs/commands/lagoon_list_projects.md | 1 + docs/commands/lagoon_list_rocketchat.md | 1 + docs/commands/lagoon_list_slack.md | 1 + docs/commands/lagoon_list_tasks.md | 1 + docs/commands/lagoon_list_users.md | 1 + docs/commands/lagoon_list_variables.md | 1 + docs/commands/lagoon_login.md | 1 + docs/commands/lagoon_run.md | 1 + docs/commands/lagoon_run_custom.md | 1 + docs/commands/lagoon_run_drush-archivedump.md | 1 + docs/commands/lagoon_run_drush-cacheclear.md | 1 + docs/commands/lagoon_run_drush-sqldump.md | 1 + docs/commands/lagoon_ssh.md | 1 + docs/commands/lagoon_update.md | 1 + docs/commands/lagoon_update_project.md | 1 + docs/commands/lagoon_update_rocketchat.md | 1 + docs/commands/lagoon_update_slack.md | 1 + docs/commands/lagoon_update_user.md | 1 + docs/commands/lagoon_version.md | 1 + docs/commands/lagoon_web.md | 1 + internal/helpers/helpers.go | 8 ++------ 71 files changed, 75 insertions(+), 10 deletions(-) diff --git a/cmd/config.go b/cmd/config.go index e9d5651e..270f7f8d 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -219,6 +219,7 @@ func init() { configAddCmd.Flags().StringVarP(&lagoonGraphQL, "graphql", "g", "", "Lagoon GraphQL endpoint") configAddCmd.Flags().StringVarP(&lagoonToken, "token", "t", "", "Lagoon GraphQL token") configAddCmd.Flags().StringVarP(&lagoonUI, "ui", "u", "", "Lagoon UI location (https://ui-lagoon-master.ch.amazee.io)") + configAddCmd.PersistentFlags().BoolVarP(&createConfig, "create-config", "", false, "Create the config file if it is non existent (to be used with --config-file)") configAddCmd.Flags().StringVarP(&lagoonKibana, "kibana", "k", "", "Lagoon Kibana URL (https://logs-db-ui-lagoon-master.ch.amazee.io)") configFeatureSwitch.Flags().StringVarP(&updateCheck, "disable-update-check", "", "", "Enable or disable checking of updates (true/false)") } diff --git a/cmd/root.go b/cmd/root.go index a663d542..ae08bf11 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -33,6 +33,7 @@ var docsFlag bool var updateInterval = time.Hour * 24 * 7 // One week interval between updates var configName = ".lagoon" var configExtension = ".yml" +var createConfig bool var userPath string var updateDocURL = "https://amazeeio.github.io/lagoon-cli" @@ -132,8 +133,7 @@ func init() { rootCmd.PersistentFlags().BoolVarP(&skipUpdateCheck, "skip-update-check", "", false, "Skip checking for updates") // get config-file from flag - rootCmd.PersistentFlags().StringP("config-file", "", "", "Path to the config file you want to use instead of the default (must be .yml or .yaml)") - rootCmd.PersistentFlags().BoolP("create-config", "", false, "Create the config file if it is non existent") + rootCmd.PersistentFlags().StringP("config-file", "", "", "Path to the config file to use (must be *.yml or *.yaml)") rootCmd.Flags().BoolVarP(&versionFlag, "version", "", false, "Version information") rootCmd.Flags().BoolVarP(&docsFlag, "docs", "", false, "Generate docs") @@ -208,12 +208,11 @@ func initConfig() { } // check if we are being given a path to a different config file - err = helpers.GetLagoonConfigFile(&userPath, &configName, &configExtension, rootCmd) + err = helpers.GetLagoonConfigFile(&userPath, &configName, &configExtension, createConfig, rootCmd) if err != nil { output.RenderError(err.Error(), outputOptions) os.Exit(1) } - fmt.Println(userPath, configName) // Search config in userPath directory with default name ".lagoon" (without extension). // @todo see if we can grok the proper info from the cwd .lagoon.yml diff --git a/docs/commands/lagoon.md b/docs/commands/lagoon.md index 32811fd3..ee587052 100644 --- a/docs/commands/lagoon.md +++ b/docs/commands/lagoon.md @@ -13,6 +13,7 @@ lagoon [flags] ### Options ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_add.md b/docs/commands/lagoon_add.md index 5a381094..55772fb6 100644 --- a/docs/commands/lagoon_add.md +++ b/docs/commands/lagoon_add.md @@ -15,6 +15,7 @@ Add a project, or add notifications and variables to projects or environments ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_add_group.md b/docs/commands/lagoon_add_group.md index 1c92e1cc..e90237eb 100644 --- a/docs/commands/lagoon_add_group.md +++ b/docs/commands/lagoon_add_group.md @@ -20,6 +20,7 @@ lagoon add group [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_add_project-group.md b/docs/commands/lagoon_add_project-group.md index ebefc57a..abc4bec6 100644 --- a/docs/commands/lagoon_add_project-group.md +++ b/docs/commands/lagoon_add_project-group.md @@ -20,6 +20,7 @@ lagoon add project-group [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_add_project-rocketchat.md b/docs/commands/lagoon_add_project-rocketchat.md index 49778679..a684d95c 100644 --- a/docs/commands/lagoon_add_project-rocketchat.md +++ b/docs/commands/lagoon_add_project-rocketchat.md @@ -21,6 +21,7 @@ lagoon add project-rocketchat [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_add_project-slack.md b/docs/commands/lagoon_add_project-slack.md index 69f34924..c4f83767 100644 --- a/docs/commands/lagoon_add_project-slack.md +++ b/docs/commands/lagoon_add_project-slack.md @@ -21,6 +21,7 @@ lagoon add project-slack [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_add_project.md b/docs/commands/lagoon_add_project.md index 32de5188..e81e4587 100644 --- a/docs/commands/lagoon_add_project.md +++ b/docs/commands/lagoon_add_project.md @@ -35,6 +35,7 @@ lagoon add project [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_add_rocketchat.md b/docs/commands/lagoon_add_rocketchat.md index 32be5a7c..5aa3b118 100644 --- a/docs/commands/lagoon_add_rocketchat.md +++ b/docs/commands/lagoon_add_rocketchat.md @@ -24,6 +24,7 @@ lagoon add rocketchat [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_add_slack.md b/docs/commands/lagoon_add_slack.md index d13f55b6..59225a1b 100644 --- a/docs/commands/lagoon_add_slack.md +++ b/docs/commands/lagoon_add_slack.md @@ -24,6 +24,7 @@ lagoon add slack [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_add_user-group.md b/docs/commands/lagoon_add_user-group.md index 84cfb58d..4a55e4ac 100644 --- a/docs/commands/lagoon_add_user-group.md +++ b/docs/commands/lagoon_add_user-group.md @@ -22,6 +22,7 @@ lagoon add user-group [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_add_user-sshkey.md b/docs/commands/lagoon_add_user-sshkey.md index 04ff3850..e1ee3b5e 100644 --- a/docs/commands/lagoon_add_user-sshkey.md +++ b/docs/commands/lagoon_add_user-sshkey.md @@ -22,6 +22,7 @@ lagoon add user-sshkey [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_add_user.md b/docs/commands/lagoon_add_user.md index 26dbef15..e23944bb 100644 --- a/docs/commands/lagoon_add_user.md +++ b/docs/commands/lagoon_add_user.md @@ -22,6 +22,7 @@ lagoon add user [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_add_variable.md b/docs/commands/lagoon_add_variable.md index d5c2f122..94c117d4 100644 --- a/docs/commands/lagoon_add_variable.md +++ b/docs/commands/lagoon_add_variable.md @@ -23,6 +23,7 @@ lagoon add variable [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_config.md b/docs/commands/lagoon_config.md index 8cfeecac..9a3417df 100644 --- a/docs/commands/lagoon_config.md +++ b/docs/commands/lagoon_config.md @@ -15,6 +15,7 @@ Configure Lagoon CLI ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_config_add.md b/docs/commands/lagoon_config_add.md index 7e495d1d..46d945e7 100644 --- a/docs/commands/lagoon_config_add.md +++ b/docs/commands/lagoon_config_add.md @@ -13,6 +13,7 @@ lagoon config add [flags] ### Options ``` + --create-config Create the config file if it is non existent (to be used with --config-file) -g, --graphql string Lagoon GraphQL endpoint -h, --help help for add -H, --hostname string Lagoon SSH hostname @@ -25,6 +26,7 @@ lagoon config add [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_config_default.md b/docs/commands/lagoon_config_default.md index 7de06808..ef16f343 100644 --- a/docs/commands/lagoon_config_default.md +++ b/docs/commands/lagoon_config_default.md @@ -19,6 +19,7 @@ lagoon config default [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_config_delete.md b/docs/commands/lagoon_config_delete.md index 3273eeab..999a686c 100644 --- a/docs/commands/lagoon_config_delete.md +++ b/docs/commands/lagoon_config_delete.md @@ -19,6 +19,7 @@ lagoon config delete [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_config_feature.md b/docs/commands/lagoon_config_feature.md index ae3a1756..0a2eb9eb 100644 --- a/docs/commands/lagoon_config_feature.md +++ b/docs/commands/lagoon_config_feature.md @@ -20,6 +20,7 @@ lagoon config feature [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_config_list.md b/docs/commands/lagoon_config_list.md index 5ff53fe9..f5f6cff5 100644 --- a/docs/commands/lagoon_config_list.md +++ b/docs/commands/lagoon_config_list.md @@ -19,6 +19,7 @@ lagoon config list [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_delete.md b/docs/commands/lagoon_delete.md index 2db9b43a..4c077ee0 100644 --- a/docs/commands/lagoon_delete.md +++ b/docs/commands/lagoon_delete.md @@ -15,6 +15,7 @@ Delete a project, or delete notifications and variables from projects or environ ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_delete_environment.md b/docs/commands/lagoon_delete_environment.md index 6781f712..c28af6b8 100644 --- a/docs/commands/lagoon_delete_environment.md +++ b/docs/commands/lagoon_delete_environment.md @@ -19,6 +19,7 @@ lagoon delete environment [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_delete_group.md b/docs/commands/lagoon_delete_group.md index 616b23b1..e6b9939a 100644 --- a/docs/commands/lagoon_delete_group.md +++ b/docs/commands/lagoon_delete_group.md @@ -20,6 +20,7 @@ lagoon delete group [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_delete_project-group.md b/docs/commands/lagoon_delete_project-group.md index 53d66b5f..f5c1bbc2 100644 --- a/docs/commands/lagoon_delete_project-group.md +++ b/docs/commands/lagoon_delete_project-group.md @@ -20,6 +20,7 @@ lagoon delete project-group [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_delete_project-rocketchat.md b/docs/commands/lagoon_delete_project-rocketchat.md index 6918d8e1..5bd6c49d 100644 --- a/docs/commands/lagoon_delete_project-rocketchat.md +++ b/docs/commands/lagoon_delete_project-rocketchat.md @@ -20,6 +20,7 @@ lagoon delete project-rocketchat [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_delete_project-slack.md b/docs/commands/lagoon_delete_project-slack.md index 8e8e5df8..a196e39d 100644 --- a/docs/commands/lagoon_delete_project-slack.md +++ b/docs/commands/lagoon_delete_project-slack.md @@ -20,6 +20,7 @@ lagoon delete project-slack [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_delete_project.md b/docs/commands/lagoon_delete_project.md index fd3e42c8..68ae4e3e 100644 --- a/docs/commands/lagoon_delete_project.md +++ b/docs/commands/lagoon_delete_project.md @@ -19,6 +19,7 @@ lagoon delete project [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_delete_rocketchat.md b/docs/commands/lagoon_delete_rocketchat.md index 7d6bfd8f..5eda6419 100644 --- a/docs/commands/lagoon_delete_rocketchat.md +++ b/docs/commands/lagoon_delete_rocketchat.md @@ -19,6 +19,7 @@ lagoon delete rocketchat [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_delete_slack.md b/docs/commands/lagoon_delete_slack.md index 1cc22103..b4c45edc 100644 --- a/docs/commands/lagoon_delete_slack.md +++ b/docs/commands/lagoon_delete_slack.md @@ -19,6 +19,7 @@ lagoon delete slack [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_delete_user-group.md b/docs/commands/lagoon_delete_user-group.md index a06b1450..8eed88c5 100644 --- a/docs/commands/lagoon_delete_user-group.md +++ b/docs/commands/lagoon_delete_user-group.md @@ -21,6 +21,7 @@ lagoon delete user-group [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_delete_user-sshkey.md b/docs/commands/lagoon_delete_user-sshkey.md index c3a22b1f..1f6fa75d 100644 --- a/docs/commands/lagoon_delete_user-sshkey.md +++ b/docs/commands/lagoon_delete_user-sshkey.md @@ -20,6 +20,7 @@ lagoon delete user-sshkey [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_delete_user.md b/docs/commands/lagoon_delete_user.md index 2e1b074c..0ba1c038 100644 --- a/docs/commands/lagoon_delete_user.md +++ b/docs/commands/lagoon_delete_user.md @@ -20,6 +20,7 @@ lagoon delete user [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_delete_variable.md b/docs/commands/lagoon_delete_variable.md index ce28b758..8db024a1 100644 --- a/docs/commands/lagoon_delete_variable.md +++ b/docs/commands/lagoon_delete_variable.md @@ -20,6 +20,7 @@ lagoon delete variable [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_deploy.md b/docs/commands/lagoon_deploy.md index 24be8432..b436ed3f 100644 --- a/docs/commands/lagoon_deploy.md +++ b/docs/commands/lagoon_deploy.md @@ -15,6 +15,7 @@ Deploy a branch or environment ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_deploy_branch.md b/docs/commands/lagoon_deploy_branch.md index 5c2b2935..2f218b15 100644 --- a/docs/commands/lagoon_deploy_branch.md +++ b/docs/commands/lagoon_deploy_branch.md @@ -20,6 +20,7 @@ lagoon deploy branch [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_deploy_promote.md b/docs/commands/lagoon_deploy_promote.md index bb94996b..63c7e26a 100644 --- a/docs/commands/lagoon_deploy_promote.md +++ b/docs/commands/lagoon_deploy_promote.md @@ -21,6 +21,7 @@ lagoon deploy promote [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_get.md b/docs/commands/lagoon_get.md index 0801411b..3040fe9b 100644 --- a/docs/commands/lagoon_get.md +++ b/docs/commands/lagoon_get.md @@ -15,6 +15,7 @@ Get info on a resource ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_get_all-user-sshkeys.md b/docs/commands/lagoon_get_all-user-sshkeys.md index b50c83aa..64bfeb1e 100644 --- a/docs/commands/lagoon_get_all-user-sshkeys.md +++ b/docs/commands/lagoon_get_all-user-sshkeys.md @@ -20,6 +20,7 @@ lagoon get all-user-sshkeys [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_get_deployment.md b/docs/commands/lagoon_get_deployment.md index 74673efd..e98efa59 100644 --- a/docs/commands/lagoon_get_deployment.md +++ b/docs/commands/lagoon_get_deployment.md @@ -20,6 +20,7 @@ lagoon get deployment [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_get_environment.md b/docs/commands/lagoon_get_environment.md index 7e9f817f..1b6fde89 100644 --- a/docs/commands/lagoon_get_environment.md +++ b/docs/commands/lagoon_get_environment.md @@ -19,6 +19,7 @@ lagoon get environment [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_get_project-key.md b/docs/commands/lagoon_get_project-key.md index 436bfe39..9db7736f 100644 --- a/docs/commands/lagoon_get_project-key.md +++ b/docs/commands/lagoon_get_project-key.md @@ -20,6 +20,7 @@ lagoon get project-key [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_get_project.md b/docs/commands/lagoon_get_project.md index dbe17483..05d7e527 100644 --- a/docs/commands/lagoon_get_project.md +++ b/docs/commands/lagoon_get_project.md @@ -19,6 +19,7 @@ lagoon get project [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_get_user-sshkeys.md b/docs/commands/lagoon_get_user-sshkeys.md index fec5e9d8..4ca959e8 100644 --- a/docs/commands/lagoon_get_user-sshkeys.md +++ b/docs/commands/lagoon_get_user-sshkeys.md @@ -21,6 +21,7 @@ lagoon get user-sshkeys [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_kibana.md b/docs/commands/lagoon_kibana.md index c1b6747a..187df728 100644 --- a/docs/commands/lagoon_kibana.md +++ b/docs/commands/lagoon_kibana.md @@ -19,6 +19,7 @@ lagoon kibana [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_list.md b/docs/commands/lagoon_list.md index b4c80f41..2831e31f 100644 --- a/docs/commands/lagoon_list.md +++ b/docs/commands/lagoon_list.md @@ -16,6 +16,7 @@ List projects, deployments, variables or notifications ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_list_deployments.md b/docs/commands/lagoon_list_deployments.md index b9bd45e3..6175372a 100644 --- a/docs/commands/lagoon_list_deployments.md +++ b/docs/commands/lagoon_list_deployments.md @@ -19,6 +19,7 @@ lagoon list deployments [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_list_environments.md b/docs/commands/lagoon_list_environments.md index 2ad5fb7a..504151f2 100644 --- a/docs/commands/lagoon_list_environments.md +++ b/docs/commands/lagoon_list_environments.md @@ -19,6 +19,7 @@ lagoon list environments [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_list_group-projects.md b/docs/commands/lagoon_list_group-projects.md index 5039ddf1..754e1e6b 100644 --- a/docs/commands/lagoon_list_group-projects.md +++ b/docs/commands/lagoon_list_group-projects.md @@ -20,6 +20,7 @@ lagoon list group-projects [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_list_groups.md b/docs/commands/lagoon_list_groups.md index f1e59bb8..40f5cf53 100644 --- a/docs/commands/lagoon_list_groups.md +++ b/docs/commands/lagoon_list_groups.md @@ -19,6 +19,7 @@ lagoon list groups [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_list_projects.md b/docs/commands/lagoon_list_projects.md index 7831278d..7b9fa690 100644 --- a/docs/commands/lagoon_list_projects.md +++ b/docs/commands/lagoon_list_projects.md @@ -19,6 +19,7 @@ lagoon list projects [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_list_rocketchat.md b/docs/commands/lagoon_list_rocketchat.md index e298758f..0f3544b0 100644 --- a/docs/commands/lagoon_list_rocketchat.md +++ b/docs/commands/lagoon_list_rocketchat.md @@ -19,6 +19,7 @@ lagoon list rocketchat [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_list_slack.md b/docs/commands/lagoon_list_slack.md index 6a01b4b5..ab67a6cc 100644 --- a/docs/commands/lagoon_list_slack.md +++ b/docs/commands/lagoon_list_slack.md @@ -19,6 +19,7 @@ lagoon list slack [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_list_tasks.md b/docs/commands/lagoon_list_tasks.md index 187bb358..6d3aac8c 100644 --- a/docs/commands/lagoon_list_tasks.md +++ b/docs/commands/lagoon_list_tasks.md @@ -19,6 +19,7 @@ lagoon list tasks [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_list_users.md b/docs/commands/lagoon_list_users.md index 27e73259..7a22d8d7 100644 --- a/docs/commands/lagoon_list_users.md +++ b/docs/commands/lagoon_list_users.md @@ -20,6 +20,7 @@ lagoon list users [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_list_variables.md b/docs/commands/lagoon_list_variables.md index c1ae7707..a4c01425 100644 --- a/docs/commands/lagoon_list_variables.md +++ b/docs/commands/lagoon_list_variables.md @@ -20,6 +20,7 @@ lagoon list variables [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_login.md b/docs/commands/lagoon_login.md index 77d2259e..f0861735 100644 --- a/docs/commands/lagoon_login.md +++ b/docs/commands/lagoon_login.md @@ -19,6 +19,7 @@ lagoon login [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_run.md b/docs/commands/lagoon_run.md index cf91be76..23d70994 100644 --- a/docs/commands/lagoon_run.md +++ b/docs/commands/lagoon_run.md @@ -15,6 +15,7 @@ Run a task against an environment ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_run_custom.md b/docs/commands/lagoon_run_custom.md index 8504c6d7..a9cde07c 100644 --- a/docs/commands/lagoon_run_custom.md +++ b/docs/commands/lagoon_run_custom.md @@ -33,6 +33,7 @@ lagoon run custom [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_run_drush-archivedump.md b/docs/commands/lagoon_run_drush-archivedump.md index 589b4a00..db08c86c 100644 --- a/docs/commands/lagoon_run_drush-archivedump.md +++ b/docs/commands/lagoon_run_drush-archivedump.md @@ -19,6 +19,7 @@ lagoon run drush-archivedump [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_run_drush-cacheclear.md b/docs/commands/lagoon_run_drush-cacheclear.md index b5c38482..04959bac 100644 --- a/docs/commands/lagoon_run_drush-cacheclear.md +++ b/docs/commands/lagoon_run_drush-cacheclear.md @@ -19,6 +19,7 @@ lagoon run drush-cacheclear [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_run_drush-sqldump.md b/docs/commands/lagoon_run_drush-sqldump.md index 98861d91..e711fa18 100644 --- a/docs/commands/lagoon_run_drush-sqldump.md +++ b/docs/commands/lagoon_run_drush-sqldump.md @@ -19,6 +19,7 @@ lagoon run drush-sqldump [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_ssh.md b/docs/commands/lagoon_ssh.md index 0e35a54f..f4c517e2 100644 --- a/docs/commands/lagoon_ssh.md +++ b/docs/commands/lagoon_ssh.md @@ -23,6 +23,7 @@ lagoon ssh [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_update.md b/docs/commands/lagoon_update.md index 5252eb21..51e20732 100644 --- a/docs/commands/lagoon_update.md +++ b/docs/commands/lagoon_update.md @@ -15,6 +15,7 @@ Update a resource ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_update_project.md b/docs/commands/lagoon_update_project.md index 1ba60339..33b0fb66 100644 --- a/docs/commands/lagoon_update_project.md +++ b/docs/commands/lagoon_update_project.md @@ -35,6 +35,7 @@ lagoon update project [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_update_rocketchat.md b/docs/commands/lagoon_update_rocketchat.md index dceb1073..bc465a80 100644 --- a/docs/commands/lagoon_update_rocketchat.md +++ b/docs/commands/lagoon_update_rocketchat.md @@ -24,6 +24,7 @@ lagoon update rocketchat [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_update_slack.md b/docs/commands/lagoon_update_slack.md index 63c08817..33d0c434 100644 --- a/docs/commands/lagoon_update_slack.md +++ b/docs/commands/lagoon_update_slack.md @@ -24,6 +24,7 @@ lagoon update slack [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_update_user.md b/docs/commands/lagoon_update_user.md index 9794c475..a93bfe0c 100644 --- a/docs/commands/lagoon_update_user.md +++ b/docs/commands/lagoon_update_user.md @@ -23,6 +23,7 @@ lagoon update user [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_version.md b/docs/commands/lagoon_version.md index 371b764a..287426bc 100644 --- a/docs/commands/lagoon_version.md +++ b/docs/commands/lagoon_version.md @@ -19,6 +19,7 @@ lagoon version [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_web.md b/docs/commands/lagoon_web.md index 4bf231f8..e810d1ff 100644 --- a/docs/commands/lagoon_web.md +++ b/docs/commands/lagoon_web.md @@ -19,6 +19,7 @@ lagoon web [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/internal/helpers/helpers.go b/internal/helpers/helpers.go index cb0ea978..9cba84e8 100644 --- a/internal/helpers/helpers.go +++ b/internal/helpers/helpers.go @@ -23,18 +23,14 @@ func FileExists(filename string) bool { } // GetLagoonConfigFile . -func GetLagoonConfigFile(userPath *string, configName *string, configExtension *string, cmd *cobra.Command) error { +func GetLagoonConfigFile(userPath *string, configName *string, configExtension *string, createConfig bool, cmd *cobra.Command) error { // check if we have an envvar to define our confg file var configFilePath string - createConfig, err := cmd.Flags().GetBool("create-config") - if err != nil { - return err - } if lagoonConfigEnvar, ok := os.LookupEnv("LAGOONCONFIG"); !ok { configFilePath = lagoonConfigEnvar } // otherwise check the flag - configFilePath, err = cmd.Flags().GetString("config-file") + configFilePath, err := cmd.Flags().GetString("config-file") if err != nil { return err } From 41186f5baf3e28fa823d673e261f6680f424c814 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Thu, 2 Apr 2020 11:15:34 +1100 Subject: [PATCH 4/7] configfile path is different from userpath --- cmd/config.go | 6 +++--- cmd/root.go | 8 +++++--- internal/helpers/helpers.go | 6 +++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/cmd/config.go b/cmd/config.go index 07551ddb..2ced01c2 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -59,7 +59,7 @@ var configDefaultCmd = &cobra.Command{ os.Exit(1) } viper.Set("default", strings.TrimSpace(string(lagoonConfig.Lagoon))) - err := viper.WriteConfigAs(filepath.Join(userPath, configName+configExtension)) + err := viper.WriteConfigAs(filepath.Join(configFilePath, configName+configExtension)) handleError(err) resultData := output.Result{ @@ -141,7 +141,7 @@ var configAddCmd = &cobra.Command{ if lagoonConfig.Token != "" { viper.Set("lagoons."+lagoonConfig.Lagoon+".token", lagoonConfig.Token) } - err := viper.WriteConfigAs(filepath.Join(userPath, configName+configExtension)) + err := viper.WriteConfigAs(filepath.Join(configFilePath, configName+configExtension)) if err != nil { output.RenderError(err.Error(), outputOptions) os.Exit(1) @@ -197,7 +197,7 @@ var configFeatureSwitch = &cobra.Command{ case "false": viper.Set("updateCheckDisable", false) } - err := viper.WriteConfigAs(filepath.Join(userPath, configName+configExtension)) + err := viper.WriteConfigAs(filepath.Join(configFilePath, configName+configExtension)) if err != nil { output.RenderError(err.Error(), outputOptions) os.Exit(1) diff --git a/cmd/root.go b/cmd/root.go index 29e2cfd5..5207c110 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -35,6 +35,7 @@ var configName = ".lagoon" var configExtension = ".yml" var createConfig bool var userPath string +var configFilePath string var updateDocURL = "https://amazeeio.github.io/lagoon-cli" var skipUpdateCheck bool @@ -207,9 +208,10 @@ func initConfig() { output.RenderError(fmt.Errorf("couldn't get $HOME: %v", err).Error(), outputOptions) os.Exit(1) } + configFilePath := userPath // check if we are being given a path to a different config file - err = helpers.GetLagoonConfigFile(&userPath, &configName, &configExtension, createConfig, rootCmd) + err = helpers.GetLagoonConfigFile(&configFilePath, &configName, &configExtension, createConfig, rootCmd) if err != nil { output.RenderError(err.Error(), outputOptions) os.Exit(1) @@ -218,7 +220,7 @@ func initConfig() { // Search config in userPath directory with default name ".lagoon" (without extension). // @todo see if we can grok the proper info from the cwd .lagoon.yml viper.SetConfigType("yaml") - viper.AddConfigPath(userPath) + viper.AddConfigPath(configFilePath) viper.SetConfigName(configName) err = viper.ReadInConfig() if err != nil { @@ -230,7 +232,7 @@ func initConfig() { viper.SetDefault("lagoons.amazeeio.ui", "https://ui-lagoon-master.ch.amazee.io") viper.SetDefault("lagoons.amazeeio.kibana", "https://logs-db-ui-lagoon-master.ch.amazee.io/") viper.SetDefault("default", "amazeeio") - err = viper.WriteConfigAs(filepath.Join(userPath, configName+configExtension)) + err = viper.WriteConfigAs(filepath.Join(configFilePath, configName+configExtension)) if err != nil { output.RenderError(err.Error(), outputOptions) os.Exit(1) diff --git a/internal/helpers/helpers.go b/internal/helpers/helpers.go index 9cba84e8..b59313ee 100644 --- a/internal/helpers/helpers.go +++ b/internal/helpers/helpers.go @@ -23,7 +23,7 @@ func FileExists(filename string) bool { } // GetLagoonConfigFile . -func GetLagoonConfigFile(userPath *string, configName *string, configExtension *string, createConfig bool, cmd *cobra.Command) error { +func GetLagoonConfigFile(configPath *string, configName *string, configExtension *string, createConfig bool, cmd *cobra.Command) error { // check if we have an envvar to define our confg file var configFilePath string if lagoonConfigEnvar, ok := os.LookupEnv("LAGOONCONFIG"); !ok { @@ -36,12 +36,12 @@ func GetLagoonConfigFile(userPath *string, configName *string, configExtension * } if configFilePath != "" { if FileExists(configFilePath) || createConfig { - *userPath = filepath.Dir(configFilePath) + *configPath = filepath.Dir(configFilePath) *configExtension = filepath.Ext(configFilePath) *configName = strings.TrimSuffix(filepath.Base(configFilePath), *configExtension) return nil } - return fmt.Errorf("%s/%s File doesn't exist", *userPath, configFilePath) + return fmt.Errorf("%s/%s File doesn't exist", *configPath, configFilePath) } // no config file found From 5cec1d7e16c1517a61e80b08cdd721cb5f59c17c Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Thu, 2 Apr 2020 11:36:44 +1100 Subject: [PATCH 5/7] check for flag and envar fixes --- internal/helpers/helpers.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/helpers/helpers.go b/internal/helpers/helpers.go index b59313ee..40e23382 100644 --- a/internal/helpers/helpers.go +++ b/internal/helpers/helpers.go @@ -24,16 +24,17 @@ func FileExists(filename string) bool { // GetLagoonConfigFile . func GetLagoonConfigFile(configPath *string, configName *string, configExtension *string, createConfig bool, cmd *cobra.Command) error { - // check if we have an envvar to define our confg file + // check if we have an envvar or flag to define our confg file var configFilePath string - if lagoonConfigEnvar, ok := os.LookupEnv("LAGOONCONFIG"); !ok { - configFilePath = lagoonConfigEnvar - } - // otherwise check the flag configFilePath, err := cmd.Flags().GetString("config-file") if err != nil { return err } + if configFilePath == "" { + if lagoonConfigEnvar, ok := os.LookupEnv("LAGOONCONFIG"); ok { + configFilePath = lagoonConfigEnvar + } + } if configFilePath != "" { if FileExists(configFilePath) || createConfig { *configPath = filepath.Dir(configFilePath) From dd6afc7084cdf45d04f45fecfca31019d7d01988 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Thu, 2 Apr 2020 11:37:42 +1100 Subject: [PATCH 6/7] add note --- internal/helpers/helpers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/helpers/helpers.go b/internal/helpers/helpers.go index 40e23382..a9cde2a2 100644 --- a/internal/helpers/helpers.go +++ b/internal/helpers/helpers.go @@ -22,7 +22,7 @@ func FileExists(filename string) bool { return !info.IsDir() } -// GetLagoonConfigFile . +// GetLagoonConfigFile get the configpath, name and extension from the config init so we can pass it back to be used by the rest of the cli func GetLagoonConfigFile(configPath *string, configName *string, configExtension *string, createConfig bool, cmd *cobra.Command) error { // check if we have an envvar or flag to define our confg file var configFilePath string From 7be64e421d2ac58a7c9b0133899b71aa0c213087 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Thu, 2 Apr 2020 11:48:56 +1100 Subject: [PATCH 7/7] add docs --- docs/commands/lagoon_config_current.md | 1 + docs/commands/lagoon_export.md | 1 + docs/commands/lagoon_import.md | 1 + 3 files changed, 3 insertions(+) diff --git a/docs/commands/lagoon_config_current.md b/docs/commands/lagoon_config_current.md index ad7d9d5f..b04cd807 100644 --- a/docs/commands/lagoon_config_current.md +++ b/docs/commands/lagoon_config_current.md @@ -19,6 +19,7 @@ lagoon config current [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_export.md b/docs/commands/lagoon_export.md index 275fcf6b..6d850c31 100644 --- a/docs/commands/lagoon_export.md +++ b/docs/commands/lagoon_export.md @@ -21,6 +21,7 @@ lagoon export [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported) diff --git a/docs/commands/lagoon_import.md b/docs/commands/lagoon_import.md index 410e6aa9..fbcd8e90 100644 --- a/docs/commands/lagoon_import.md +++ b/docs/commands/lagoon_import.md @@ -24,6 +24,7 @@ lagoon import [flags] ### Options inherited from parent commands ``` + --config-file string Path to the config file to use (must be *.yml or *.yaml) --debug Enable debugging output (if supported) -e, --environment string Specify an environment to use --force Force yes on prompts (if supported)