Upgrade urfave/cli from v2 to v3 to support flexible flag placement#545
Upgrade urfave/cli from v2 to v3 to support flexible flag placement#545
Conversation
Co-authored-by: aooohan <40265686+aooohan@users.noreply.github.com>
Co-authored-by: aooohan <40265686+aooohan@users.noreply.github.com>
…commands Co-authored-by: aooohan <40265686+aooohan@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR upgrades the urfave/cli library from v2 to v3 to enable flexible flag placement, addressing a usability issue where flags had to be placed before arguments. The upgrade allows natural command patterns like vfox use java@21 --global while maintaining backward compatibility.
- Upgraded urfave/cli dependency from v2.27.1 to v3.4.1
- Updated function signatures across all command handlers to match v3 API
- Added test coverage for use command scope selection and validation
Reviewed Changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| go.mod | Updated dependency from urfave/cli/v2 to v3 with version bump and removed indirect dependencies |
| internal/manager.go | Updated import statement to use v3 |
| cmd/cmd.go | Updated main CLI app configuration for v3 API changes |
| cmd/commands/*.go | Migrated all 18 command handlers to new v3 function signatures |
| cmd/commands/use_test.go | Added comprehensive test coverage for use command functionality |
| docs/*.md | Updated documentation to reflect flexible flag placement support |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #545 +/- ##
=======================================
Coverage 21.11% 21.11%
=======================================
Files 68 68
Lines 5740 5740
=======================================
Hits 1212 1212
Misses 4439 4439
Partials 89 89 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@copilot Run go build . github.com/version-fox/vfox/cmd/commandsError: cmd\commands\upgrade_win.go:22:2: "context" imported and not used |
Co-authored-by: aooohan <40265686+aooohan@users.noreply.github.com>
Upgrade urfave/cli from v2 to v3
This PR upgrades the CLI library from v2 to v3 to enable flags to be placed after arguments (e.g.,
vfox use java@21 --global).Progress Checklist
github.com/urfave/cli/v2togithub.com/urfave/cli/v3func(*cli.Context) errortofunc(context.Context, *cli.Command) errorcli.Appwithcli.CommandBoolFlagAction signature to include bool parametervfox use --global java@21(old pattern, still works)vfox use java@21 --global(new pattern, now works)What Changed
Files Modified (24 total):
Key API Changes:
Why This Matters
The v3 library allows flags to be placed either before or after arguments, fixing the reported issue where
vfox use java@21 --globaldidn't work.User Impact:
Verification
All verification tests pass:
Testing
cmd/commands/use_test.goadds coverage for use commandDocumentation
Updated both English and Chinese documentation to show users can place flags either before or after arguments, with examples of both patterns.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.