Skip to content

feat: add Command.Walk() and Command.Path() convenience methods#2353

Merged
dearchap merged 9 commits into
urfave:mainfrom
dearchap:issue_2323
Jun 13, 2026
Merged

feat: add Command.Walk() and Command.Path() convenience methods#2353
dearchap merged 9 commits into
urfave:mainfrom
dearchap:issue_2323

Conversation

@dearchap

@dearchap dearchap commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

(REQUIRED)

  • feature

What this PR does / why we need it:

(REQUIRED)

Which issue(s) this PR fixes:

(REQUIRED)

Fixes #2324

Special notes for your reviewer:

(fill-in or delete this section)

Testing

(fill-in or delete this section)

go test -run=TestCommand_Walk
go test -run=TestCommand_Path

Release Notes

(REQUIRED)

Add Command.Path() and Command.Walk() convenience functions

@dearchap dearchap requested a review from a team as a code owner June 6, 2026 12:50
Comment thread testdata/godoc-v3.x.txt Outdated
Comment thread testdata/godoc-v3.x.txt Outdated
Comment thread command.go Outdated
@abitrolly

Copy link
Copy Markdown
Contributor

Strange that Walk didn't find the use inside current code. I thought that recursive walk over commands should happen during processing more than once.

dearchap and others added 2 commits June 8, 2026 16:07
Co-authored-by: Anatoli Babenia <anatoli@rainforce.org>

@dearchap dearchap left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed feedback on Walk godoc — removed the unclear 'pre-order' phrasing and simplified per suggestion. FullName comment was already updated in prior commit.

@abitrolly

Copy link
Copy Markdown
Contributor

Still not clear what FullName does in Path description.

@meatballhat

Copy link
Copy Markdown
Member

Missing a make v3approve?

Comment thread testdata/godoc-v3.x.txt Outdated
Comment thread command.go
@dearchap dearchap merged commit 84d0da5 into urfave:main Jun 13, 2026
9 checks passed
Comment thread command_setup.go
}
_ = cmd.Walk(func(sub *Command) error {
for _, subCmd := range sub.Commands {
subCmd.parent = sub

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Strange that parent is injected only here and not when subCmd is added into sub.Commands array.

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.

Add Command.Walk(fn) and Command.Path() convenience methods

3 participants