From 3585a542a0e07d0e9d396b2f809c2826c8536437 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Fri, 5 May 2017 00:48:23 -0400 Subject: [PATCH] cli: viper.Set(HomeFlag, rootDir) --- cli/setup.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/setup.go b/cli/setup.go index e55baf902..7a4a2098e 100644 --- a/cli/setup.go +++ b/cli/setup.go @@ -127,12 +127,12 @@ func bindFlagsLoadViper(cmd *cobra.Command, args []string) error { // rootDir is command line flag, env variable, or default $HOME/.tlc // NOTE: we support both --root and --home for now, but eventually only --home + // Also ensure we set the correct rootDir under HomeFlag so we dont need to + // repeat this logic elsewhere. rootDir := viper.GetString(HomeFlag) - // @ebuchman: viper.IsSet doesn't do what you think... - // Even a default of "" on the pflag marks it as set, - // simply by fact of having a pflag. if rootDir == "" { rootDir = viper.GetString(RootFlag) + viper.Set(HomeFlag, rootDir) } viper.SetConfigName("config") // name of config file (without extension) viper.AddConfigPath(rootDir) // search root directory