Skip to content

Commit

Permalink
feat: Bind cache flag to config
Browse files Browse the repository at this point in the history
  • Loading branch information
caffeine-addictt committed Apr 13, 2024
1 parent 4e2fe49 commit d766428
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ func init() {
rootCommand.PersistentFlags().StringVarP(&cfgFile, "config", "c", "", "config file (default is $HOME/.video-manager)")
rootCommand.PersistentFlags().StringVarP(&cacheFile, "cache", "C", "", "cache file (default is $HOME/.video-manager_history)")
viper.SetDefault("cache", filepath.Clean(filepath.Join(home, ".video-manager_history")))
if err := viper.BindPFlag("cache", rootCommand.PersistentFlags().Lookup("cache")); err != nil {
fmt.Println("Failed to bind persistent flag 'cache'")
Debug(err.Error())
os.Exit(1)
}

// Verbosity
rootCommand.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Verbose output")
Expand Down

0 comments on commit d766428

Please sign in to comment.