From 1b134f5d44d15b7bf611c568dc0106d2a421da17 Mon Sep 17 00:00:00 2001 From: Bart van Deenen Date: Thu, 19 Aug 2021 10:19:00 +0200 Subject: [PATCH] fix(strm.yaml): configuration directory wasn't set yet --- cmd/strm/main.go | 4 ++-- pkg/cmd/get.go | 1 - pkg/context/cmd.go | 6 ++---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cmd/strm/main.go b/cmd/strm/main.go index 9dafa52..a94cc8d 100644 --- a/cmd/strm/main.go +++ b/cmd/strm/main.go @@ -33,7 +33,7 @@ import ( var configPath string const ( - apiHostFlag = "api-host" + apiHostFlag = "api-host" // The environment variable prefix of all environment variables bound to our command line flags. // For example, --api-host is bound to STRM_API_HOST @@ -48,6 +48,7 @@ var RootCmd = &cobra.Command{ Use: common.RootCommandName, Short: fmt.Sprintf("Stream Machine CLI %s", cmd.Version), PersistentPreRunE: func(cmd *cobra.Command, args []string) error { + constants.ConfigPath = configPath util.CreateConfigDirAndFileIfNotExists() err := initializeConfig(cmd) @@ -60,7 +61,6 @@ var RootCmd = &cobra.Command{ } }) - constants.ConfigPath = configPath auth.SetupClient(util.GetStringAndErr(cmd.Flags(), auth.ApiAuthUrlFlag)) var billingId = "" diff --git a/pkg/cmd/get.go b/pkg/cmd/get.go index c3544d0..1a83b50 100644 --- a/pkg/cmd/get.go +++ b/pkg/cmd/get.go @@ -16,7 +16,6 @@ import ( "streammachine.io/strm/pkg/entity/usage" ) - var GetCmd = &cobra.Command{ Use: constants.GetCommandName, Short: "Get an entity", diff --git a/pkg/context/cmd.go b/pkg/context/cmd.go index 201969c..03e5645 100644 --- a/pkg/context/cmd.go +++ b/pkg/context/cmd.go @@ -29,8 +29,7 @@ func Configuration() *cobra.Command { constants.OutputFormatFlag, constants.OutputFormatFlagShort, constants.OutputFormatPlain, - fmt.Sprintf("Configuration output format [%v]", constants.ConfigOutputFormatFlagAllowedValues, - ), + fmt.Sprintf("Configuration output format [%v]", constants.ConfigOutputFormatFlagAllowedValues), ) err := configuration.RegisterFlagCompletionFunc(constants.OutputFormatFlag, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { return constants.ConfigOutputFormatFlagAllowedValues, cobra.ShellCompDirectiveNoFileComp @@ -59,8 +58,7 @@ func EntityInfo() *cobra.Command { constants.OutputFormatFlag, constants.OutputFormatFlagShort, constants.OutputFormatFilepath, - fmt.Sprintf("Entity information output format [%v]", constants.ContextOutputFormatFlagAllowedValues, - ), + fmt.Sprintf("Entity information output format [%v]", constants.ContextOutputFormatFlagAllowedValues), ) err := entityInfo.RegisterFlagCompletionFunc(constants.OutputFormatFlag, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { return constants.ContextOutputFormatFlagAllowedValues, cobra.ShellCompDirectiveNoFileComp