Skip to content

Commit

Permalink
Add flags to cli.New benchmark (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
FollowTheProcess authored Oct 6, 2024
1 parent 842c856 commit d8548d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 0 additions & 3 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,6 @@ func (c *Command) root() *Command {

// hasFlag returns whether the command has a flag of the given name defined.
func (c *Command) hasFlag(name string) bool {
if name == "" {
return false
}
flag, ok := c.flagSet().Get(name)
if !ok {
return false
Expand Down
3 changes: 3 additions & 0 deletions command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,9 @@ func BenchmarkNew(b *testing.B) {
cli.Commit("dfdddaf"),
cli.Example("An example", "bench --help"),
cli.Allow(cli.AnyArgs()),
cli.Flag(new(bool), "force", 'f', false, "Force something"),
cli.Flag(new(string), "name", 'n', "", "The name of something"),
cli.Flag(new(int), "count", 'c', 1, "Count something"),
cli.Run(func(cmd *cli.Command, args []string) error { return nil }),
)
if err != nil {
Expand Down

0 comments on commit d8548d8

Please sign in to comment.