From d0eba5e9619845423ecd3c4faf0e4959f10049c0 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 30 May 2026 22:56:16 +0200 Subject: [PATCH] chore(deps): update `urfave/cli/v3` to v3.9.0 (#37863) Updates `github.com/urfave/cli/v3` to [v3.9.0](https://github.com/urfave/cli/releases/tag/v3.9.0) and removes the renovate pin now that [urfave/cli#2319](https://github.com/urfave/cli/pull/2319) (the `-c` help flag parsing fix) is merged. v3.9.0 prepends the default command name to the root command's args, which broke the old `Root().Args()` check in `isValidDefaultSubCommand`. It now uses the command's own `Args()`. Behavior change: `./gitea web ` now errors with `unknown command` instead of starting the web server and ignoring the trailing arg. `web` takes no positional args, so this is stricter (and arguably more correct) input handling. The intended `./gitea bad-cmd` rejection is unchanged. --- This PR was written with the help of Claude Opus 4.7 --------- Co-authored-by: Claude (Opus 4.7) Co-authored-by: Nicolas --- cmd/helper.go | 6 +++--- cmd/main_test.go | 1 + go.mod | 2 +- go.sum | 4 ++-- renovate.json5 | 4 ---- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/cmd/helper.go b/cmd/helper.go index d5789a74e3..9150e1c233 100644 --- a/cmd/helper.go +++ b/cmd/helper.go @@ -142,9 +142,9 @@ func PrepareConsoleLoggerLevel(defaultLevel log.Level) func(context.Context, *cl func isValidDefaultSubCommand(cmd *cli.Command) (string, bool) { // Dirty patch for urfave/cli's strange design. // "./gitea bad-cmd" should not start the web server. - rootArgs := cmd.Root().Args().Slice() - if len(rootArgs) != 0 && rootArgs[0] != cmd.Name { - return rootArgs[0], false + args := cmd.Args().Slice() + if len(args) != 0 { + return args[0], false } return "", true } diff --git a/cmd/main_test.go b/cmd/main_test.go index 75e904ffd5..047698074c 100644 --- a/cmd/main_test.go +++ b/cmd/main_test.go @@ -41,4 +41,5 @@ func TestDefaultCommand(t *testing.T) { test(t, []string{"./gitea"}, "", true) test(t, []string{"./gitea", "test"}, "", true) test(t, []string{"./gitea", "other"}, "other", false) + test(t, []string{"./gitea", "test", "extra"}, "extra", false) } diff --git a/go.mod b/go.mod index e60b507a4b..0bac202bab 100644 --- a/go.mod +++ b/go.mod @@ -96,7 +96,7 @@ require ( github.com/tstranex/u2f v1.0.0 github.com/ulikunitz/xz v0.5.15 github.com/urfave/cli-docs/v3 v3.1.0 - github.com/urfave/cli/v3 v3.6.1 + github.com/urfave/cli/v3 v3.9.0 github.com/wneessen/go-mail v0.7.3 github.com/yohcop/openid-go v1.0.1 github.com/yuin/goldmark v1.8.2 diff --git a/go.sum b/go.sum index fb1e1463d3..08d3d896b9 100644 --- a/go.sum +++ b/go.sum @@ -719,8 +719,8 @@ github.com/unknwon/com v1.0.1 h1:3d1LTxD+Lnf3soQiD4Cp/0BRB+Rsa/+RTvz8GMMzIXs= github.com/unknwon/com v1.0.1/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM= github.com/urfave/cli-docs/v3 v3.1.0 h1:Sa5xm19IpE5gpm6tZzXdfjdFxn67PnEsE4dpXF7vsKw= github.com/urfave/cli-docs/v3 v3.1.0/go.mod h1:59d+5Hz1h6GSGJ10cvcEkbIe3j233t4XDqI72UIx7to= -github.com/urfave/cli/v3 v3.6.1 h1:j8Qq8NyUawj/7rTYdBGrxcH7A/j7/G8Q5LhWEW4G3Mo= -github.com/urfave/cli/v3 v3.6.1/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= +github.com/urfave/cli/v3 v3.9.0 h1:AV9lIiPv3ukYnxunaCUsHnEozptYmDN2F0+yWqLMn/c= +github.com/urfave/cli/v3 v3.9.0/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/wneessen/go-mail v0.7.3 h1:g3DravXC5SMlVdboFrQA8Jx95A8sOzoBeS5F+vzNRK0= github.com/wneessen/go-mail v0.7.3/go.mod h1:QGhBX0yNbc1J+Mkjcu7z2rpj4B4l+BmDY8gYznPC9sk= diff --git a/renovate.json5 b/renovate.json5 index 7584f56594..6f86c61e51 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -39,10 +39,6 @@ "matchPackageNames": ["tailwindcss"], "allowedVersions": "^3", // need to migrate }, - { - "matchPackageNames": ["github.com/urfave/cli/v3"], - "allowedVersions": "<3.6.2", // v3.6.2 breaks -c flag parsing in help commands - }, { "matchPackageNames": ["github.com/Azure/azure-sdk-for-go/sdk/azcore"], "allowedVersions": "<1.21.0", // v1.21.0+ uses API version unsupported by Azurite in CI