Skip to content

Commit

Permalink
Merge branch 'main' into issue_1916_fix1
Browse files Browse the repository at this point in the history
  • Loading branch information
dearchap committed Aug 25, 2024
2 parents 7c824a5 + cd7d34a commit f02651e
Show file tree
Hide file tree
Showing 28 changed files with 875 additions and 227 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/v1-bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ _**( Put the version of urfave/cli that you are using here )**_
## Checklist

- [ ] Are you running the latest v1 release? The list of releases is [here](https://github.com/urfave/cli/releases).
- [ ] Did you check the manual for your release? The v1 manual is [here](https://github.com/urfave/cli/blob/main/docs/v1/manual.md).
- [ ] Did you check the manual for your release? The v1 manual is [here](https://cli.urfave.org/v1/getting-started/).
- [ ] Did you perform a search about this problem? Here's the [GitHub guide](https://help.github.com/en/github/managing-your-work-on-github/using-search-to-filter-issues-and-pull-requests) about searching.

## Dependency Management
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/v2-bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ _**( Put the version of urfave/cli that you are using here )**_
## Checklist

- [ ] Are you running the latest v2 release? The list of releases is [here](https://github.com/urfave/cli/releases).
- [ ] Did you check the manual for your release? The v2 manual is [here](https://github.com/urfave/cli/blob/main/docs/v2/manual.md)
- [ ] Did you check the manual for your release? The v2 manual is [here](https://cli.urfave.org/v2/getting-started/)
- [ ] Did you perform a search about this problem? Here's the [GitHub guide](https://help.github.com/en/github/managing-your-work-on-github/using-search-to-filter-issues-and-pull-requests) about searching.

## Dependency Management
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/v3-feature-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ assignees: ''
## Checklist

* [ ] Are you running the latest v3 release? The list of releases is [here](https://github.com/urfave/cli/releases).
* [ ] Did you check the manual for your release? The v3 manual is [here](https://github.com/urfave/cli/blob/main/docs/v3/manual.md).
* [ ] Did you check the manual for your release? The v3 manual is [here](https://github.com/urfave/cli/blob/main/docs/v3/index.md).
* [ ] Did you perform a search about this feature? Here's the [GitHub guide](https://help.github.com/en/github/managing-your-work-on-github/using-search-to-filter-issues-and-pull-requests) about searching.

## What problem does this solve?
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ command line tools in Go featuring:
- environment variables
- plain text files
- structured file formats (supported via the
[`urfave/cli-altsrc`][urfave/cli-docs] module)
[`urfave/cli-altsrc`][urfave/cli-altsrc] module)

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion args_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestArgumentsSubcommand(t *testing.T) {
Max: 1,
Destination: &tval,
Config: TimestampConfig{
Layout: time.RFC3339,
Layouts: []string{time.RFC3339},
},
},
&StringArg{
Expand Down
19 changes: 13 additions & 6 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,12 +804,6 @@ func (cmd *Command) parseFlags(args Args) (Args, error) {
return cmd.Args(), err
}

tracef("normalizing flags (cmd=%[1]q)", cmd.Name)

if err := normalizeFlags(cmd.Flags, cmd.flagSet); err != nil {
return cmd.Args(), err
}

tracef("done parsing flags (cmd=%[1]q)", cmd.Name)

return cmd.Args(), nil
Expand Down Expand Up @@ -878,6 +872,19 @@ func (cmd *Command) appendFlag(fl Flag) {
}
}

// VisiblePersistentFlags returns a slice of [PersistentFlag] with Persistent=true and Hidden=false.
func (cmd *Command) VisiblePersistentFlags() []Flag {
var flags []Flag
for _, fl := range cmd.Root().Flags {
pfl, ok := fl.(PersistentFlag)
if !ok || !pfl.IsPersistent() {
continue
}
flags = append(flags, fl)
}
return visibleFlags(flags)
}

func (cmd *Command) appendCommand(aCmd *Command) {
if !hasCommand(cmd.Commands, aCmd) {
aCmd.parent = cmd
Expand Down
Loading

0 comments on commit f02651e

Please sign in to comment.