Skip to content

Commit

Permalink
Remove unneeded flagSet commands for Add,Remove,Init,Source,Update co…
Browse files Browse the repository at this point in the history
…mmands
  • Loading branch information
SwayKh committed Oct 4, 2024
1 parent 8b9fb97 commit 0c904af
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import (
"flag"
)

// Flags are in a different package, since the logger package needs the
// VerboseFlag. Moving the flags logic to commands/linksym.go causes import
// cycle since the subcommands needs logger package and Logger package would
// import commands
var (
AddFlag *flag.FlagSet
RemoveFlag *flag.FlagSet
InitFlag *flag.FlagSet
SourceFlag *flag.FlagSet
UpdateFlag *flag.FlagSet
HelpFlag *bool
VerboseFlag *bool
)
Expand All @@ -19,12 +18,5 @@ func CreateFlags() {
// Handle both -h and --help with one boolean
HelpFlag = flag.Bool("h", false, "Show help")
flag.BoolVar(HelpFlag, "help", false, "Show help")

VerboseFlag = flag.Bool("v", false, "Verbose output")

AddFlag = flag.NewFlagSet("add", flag.ExitOnError)
RemoveFlag = flag.NewFlagSet("remove", flag.ExitOnError)
InitFlag = flag.NewFlagSet("init", flag.ExitOnError)
SourceFlag = flag.NewFlagSet("source", flag.ExitOnError)
UpdateFlag = flag.NewFlagSet("update", flag.ExitOnError)
}

0 comments on commit 0c904af

Please sign in to comment.