+
Skip to content

add generated completions for shells #34973

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 12 commits into
base: main
Choose a base branch
from

Conversation

TheFox0x7
Copy link
Contributor

add makefile rule for shell completions, disable internal commands from showing in help
rework custom help so it only triggers on first level commands


help changes are mainly to work around regression: #34510 (comment)

TheFox0x7 added 8 commits July 3, 2025 23:03
since flags aren't marked as local they cascade through the app so
before can be used as setup as we need to define flags once.
only main and it's subcommands are directly handled by it
instead of looping though the flags in linage, use their non local
property
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 6, 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 labels Jul 6, 2025
cmd/main.go Outdated
for i := range command.Commands {
prepareSubcommandWithGlobalFlags(command.Commands[i])
}
command.Before = prepareWorkPathAndCustomConf()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this comment resolved?

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in short: Yes.
for background context - flags are persistent in v3 by default meaning if you define a flag at (gitea) level, then the (gitea actions) command also has it. To opt out of this you have to mark the flag as local in it's definition.
This doesn't matter for flags which are attached to final command of course as the flag has nowhere to propagate to.

Removing the loop removes the cascading issue so the setup is done only once and flags still propagate (as they aren't marked as local). This can be verified by adding a print in the function and running any nested command.
But this made me catch that i'm overwriting the original before function which I've patched just now.

@silverwind silverwind changed the title add genereted completions for shells add generated completions for shells Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/cli PR changes something on the CLI, i.e. gitea doctor or gitea admin modifies/go Pull requests that update Go code modifies/internal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载