1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Clean up the flag and config handling in main()

This commit is contained in:
Chris Cummer
2018-06-16 09:13:23 -07:00
parent dd42080ed8
commit 4496cc7c31
3 changed files with 61 additions and 55 deletions

View File

@@ -22,6 +22,10 @@ func NewFlags() *Flags {
/* -------------------- Exported Functions -------------------- */
func (flags *Flags) ConfigFilePath() string {
return flags.Config
}
func (flags *Flags) HasConfig() bool {
return len(flags.Config) > 0
}
@@ -42,6 +46,8 @@ func (flags *Flags) Parse(version string) {
}
}
// If no config file is explicitly passed in as a param,
// set the flag to the default config file
if !flags.HasConfig() {
homeDir, err := wtf.Home()
if err != nil {