Skip to content

Commit

Permalink
Post-porting fixes for v3
Browse files Browse the repository at this point in the history
  • Loading branch information
meatballhat committed Oct 3, 2022
1 parent 5db9db6 commit f8faf77
Show file tree
Hide file tree
Showing 9 changed files with 691 additions and 197 deletions.
4 changes: 2 additions & 2 deletions app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ func ExampleApp_Run_commandHelp() {
_ = app.Run(os.Args)
// Output:
// NAME:
// greet describeit [command options] [arguments...]
// greet describeit - use it to see a description
//
// USAGE:
// greet describeit [arguments...]
// greet describeit [command options] [arguments...]
//
// DESCRIPTION:
// This is how we describe describeit the function
Expand Down
4 changes: 1 addition & 3 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,7 @@ func (c *Command) VisibleFlagCategories() []VisibleFlagCategory {
if c.flagCategories == nil {
c.flagCategories = newFlagCategories()
for _, fl := range c.Flags {
if cf, ok := fl.(CategorizableFlag); ok {
c.flagCategories.AddFlag(cf.GetCategory(), cf)
}
c.flagCategories.AddFlag(fl.GetCategory(), fl)
}
}
return c.flagCategories.VisibleCategories()
Expand Down
1 change: 0 additions & 1 deletion flag-spec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# NOTE: this file is used by the tool defined in
# ./cmd/urfave-cli-genflags/main.go which uses the
# `Spec` type that maps to this file structure.

flag_types:
bool:
no_default_text: true
Expand Down
9 changes: 9 additions & 0 deletions flag_uint64_slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,15 @@ func (f *Uint64SliceFlag) stringify() string {
return stringifySliceFlag(f.Usage, f.Names(), defaultVals)
}

// RunAction executes flag action if set
func (f *Uint64SliceFlag) RunAction(c *Context) error {
if f.Action != nil {
return f.Action(c, c.Uint64Slice(f.Name))
}

return nil
}

// Uint64Slice looks up the value of a local Uint64SliceFlag, returns
// nil if not found
func (cCtx *Context) Uint64Slice(name string) []uint64 {
Expand Down
9 changes: 9 additions & 0 deletions flag_uint_slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,15 @@ func (f *UintSliceFlag) stringify() string {
return stringifySliceFlag(f.Usage, f.Names(), defaultVals)
}

// RunAction executes flag action if set
func (f *UintSliceFlag) RunAction(c *Context) error {
if f.Action != nil {
return f.Action(c, c.UintSlice(f.Name))
}

return nil
}

// UintSlice looks up the value of a local UintSliceFlag, returns
// nil if not found
func (cCtx *Context) UintSlice(name string) []uint {
Expand Down
Loading

0 comments on commit f8faf77

Please sign in to comment.