Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix:(issue_1263) FlagNames should return names set via env as well #1537

Merged
merged 1 commit into from Oct 22, 2022

Conversation

dearchap
Copy link
Contributor

What type of PR is this?

(REQUIRED)

  • bug

What this PR does / why we need it:

(REQUIRED)

Which issue(s) this PR fixes:

(REQUIRED)

Fixes #1263

Special notes for your reviewer:

(fill-in or delete this section)

Testing

(fill-in or delete this section)

make test

Release Notes

(REQUIRED)


@dearchap dearchap requested a review from a team as a code owner October 16, 2022 23:03
Comment on lines +104 to +105

return unames
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To ensure (more?) consistent behavior

Suggested change
return unames
sort.Strings(unames)
return unames

}

// FlagNames returns a slice of flag names used by the this context and all of
// its parent contexts.
func (cCtx *Context) FlagNames() []string {
var names []string
for _, pCtx := range cCtx.Lineage() {
pCtx.flagSet.Visit(makeFlagNameVisitor(&names))
names = append(names, pCtx.LocalFlagNames()...)
}
return names
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add sort.Strings here, too?

@dearchap dearchap merged commit d1ac284 into urfave:main Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flag names missing in cli.Context.FlagNames() if set via env. variables
2 participants