From 355561601b7503d7e4167684ee0751fae60fffd0 Mon Sep 17 00:00:00 2001 From: Justen Stall <39888103+justenstall@users.noreply.github.com> Date: Tue, 17 Sep 2024 12:39:10 -0400 Subject: [PATCH] Fix --config flag description to reference correct default Signed-off-by: Justen Stall <39888103+justenstall@users.noreply.github.com> --- cmd/root.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 18e462ce..0a3ef198 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -54,7 +54,7 @@ func GetRootCommand() *cobra.Command { return nil }, } - rootCmd.PersistentFlags().StringVar(&configFile, "config", "", "config file (defaults to ./vacuum.yaml) ") + rootCmd.PersistentFlags().StringVar(&configFile, "config", "", "config file (defaults to ./vacuum.conf.yaml) ") rootCmd.PersistentFlags().BoolP("time", "t", false, "Show how long vacuum took to run") rootCmd.PersistentFlags().StringP("ruleset", "r", "", "Path to a spectral ruleset configuration") rootCmd.PersistentFlags().StringP("functions", "f", "", "Path to custom functions") @@ -114,6 +114,7 @@ func useConfigFile(cmd *cobra.Command) error { } return err } + func useDefaultConfigFile() error { viper.SetConfigName("vacuum.conf") viper.SetConfigType("yaml") @@ -137,8 +138,9 @@ func useEnvironmentConfiguration() { // Environment variables can't have dashes in them viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_")) } + func useUserSuppliedConfigFile(configFilePath string) error { - viper.SetConfigFile(os.ExpandEnv(configFile)) + viper.SetConfigFile(os.ExpandEnv(configFilePath)) return viper.ReadInConfig() }