Skip to content

Migrate to urfave v3 #34510

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

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open

Conversation

TheFox0x7
Copy link
Contributor

@TheFox0x7 TheFox0x7 commented May 20, 2025

migrate cli to urfave v3

add more cli tests

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 20, 2025
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/cli PR changes something on the CLI, i.e. gitea doctor or gitea admin modifies/internal modifies/dependencies labels May 20, 2025
@TheFox0x7
Copy link
Contributor Author

For future: I don't mind you/someone else fixing/editing stuff but a heads up would be nice - especially on a WIP where half of it is hacks to get tests to pass.

Either way thanks for some cleanups on this.

@wxiaoguang
Copy link
Contributor

Sorry, I saw it had no progress for long time, and we had some discussions about the strange "config" behavior in discord, so I just tried to fix the problems. Will ask ahead next time.

@TheFox0x7
Copy link
Contributor Author

No problem, I appreciate your effort regardless. :)

@TheFox0x7 TheFox0x7 marked this pull request as ready for review June 7, 2025 22:34
docs, err := ctx.App.ToMarkdown()
if ctx.Bool("man") {
docs, err = ctx.App.ToMan()
func runDocs(_ context.Context, cmd *cli.Command) error {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reviewers: Double check if the docs are correct as the generation is weird, but it might not have the same issue as with tea due to custom help.

Copy link
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

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

Thank you very much, and there are new cool tests

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 8, 2025
@wxiaoguang wxiaoguang added this to the 1.25.0 milestone Jun 8, 2025
@wxiaoguang wxiaoguang added type/refactoring Existing code has been cleaned up. There should be no new functionality. and removed type/refactoring Existing code has been cleaned up. There should be no new functionality. labels Jun 8, 2025
Usage: "Generate self-signed certificate",
Description: `Generate a self-signed X.509 certificate for a TLS server.
// cmdCert represents the available cert sub-command.
func cmdCert() *cli.Command {
Copy link
Member

Choose a reason for hiding this comment

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

Why use a function instead of a variable here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Variables keep their state, which isn't an issue during regular usage, but it's annoying for tests.
It completely breaks flags if the command stores them as they keep their state between runs leading to cases where test which expects no --port flag for example has a --port flag set from previous run.

update copyright date and remove traceline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 1 This PR needs approval from one additional maintainer to be merged. modifies/cli PR changes something on the CLI, i.e. gitea doctor or gitea admin modifies/dependencies modifies/go Pull requests that update Go code modifies/internal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants