From 5ca8cf55084c4263453ad14b9bb9b41943928fb2 Mon Sep 17 00:00:00 2001 From: Masudur Rahman Date: Sat, 24 Feb 2024 10:08:24 +0600 Subject: [PATCH] Show default config full path Signed-off-by: Masudur Rahman --- cmd/root.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 3a575d4..bec6a7e 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -17,7 +17,11 @@ limitations under the License. package cmd import ( + "fmt" "os" + "path/filepath" + + "github.com/masudur-rahman/expense-tracker-bot/pkg" "github.com/spf13/cobra" ) @@ -51,9 +55,7 @@ func init() { // Here you will define your flags and configuration settings. // Cobra supports persistent flags, which, if defined here, // will be global for your application. - - rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is ./configs/.expense-tracker.yaml)") - // rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.expense-tracker-bot.yaml)") + rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", fmt.Sprintf("config file (default is %v)", filepath.Join(pkg.ProjectDirectory, "configs", ".expense-tracker.yaml"))) // Cobra also supports local flags, which will only run // when this action is called directly.