Skip to content

Commit

Permalink
made AddPrimaryArg have a return value
Browse files Browse the repository at this point in the history
  • Loading branch information
ComedicChimera committed May 23, 2021
1 parent 04e5097 commit c9916e4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion olive.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,13 @@ func (c *Command) AddSubcommand(name, desc string, helpEnabled bool) *Command {
}

// AddPrimaryArg adds a primary argument to the command
func (c *Command) AddPrimaryArg(name, desc string, required bool) {
func (c *Command) AddPrimaryArg(name, desc string, required bool) *PrimaryArgument {
if len(c.subcommands) > 0 {
log.Fatalf("command `%s` cannot both take a primary argument and have subcommands", c.Name)
}

c.primaryArg = &PrimaryArgument{name: name, desc: desc, required: required}
return c.primaryArg
}

// AddFlag adds a flag to the command
Expand Down

0 comments on commit c9916e4

Please sign in to comment.