Skip to content

Comments

Improve CLI commands#34973

Merged
wxiaoguang merged 17 commits intogo-gitea:mainfrom
TheFox0x7:cli-improvements
Jul 10, 2025
Merged

Improve CLI commands#34973
wxiaoguang merged 17 commits intogo-gitea:mainfrom
TheFox0x7:cli-improvements

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
Makefile Outdated
Comment on lines 918 to 924
.PHONY: generate-completions
generate-completions: ## generate shell completions
@[ -f gitea ] || make backend
@./gitea completion bash > contrib/autocompletion/bash_autocomplete
@./gitea completion zsh > contrib/autocompletion/zsh_autocomplete
@./gitea completion fish > contrib/autocompletion/gitea.fish

Copy link
Contributor

Choose a reason for hiding this comment

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

When end users need the "autocompletion", they must have had the "gitea" binary on their filesystem.

So I think it's better to remove contrib/autocompletion/*, just tell end users to generate their autocompletion scripts by running the command.

Then we do not need to maintain these scripts in this repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dropped in d66fa8c

@silverwind silverwind changed the title add genereted completions for shells add generated completions for shells Jul 7, 2025
@lunny lunny added this to the 1.25.0 milestone Jul 9, 2025
work-path first, then config, then custom path
@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 Jul 9, 2025
@wxiaoguang wxiaoguang changed the title add generated completions for shells Improve CLI commands Jul 10, 2025
@wxiaoguang
Copy link
Contributor

Made more improvements to the "help" command/flag and added some tests. Does it look good to you?

@wxiaoguang wxiaoguang added the type/enhancement An improvement of existing functionality label Jul 10, 2025
@TheFox0x7
Copy link
Contributor Author

It does. With that test rework we could add Validation func to this to check early if the file exists or is what it should be. Not sure if this something we want to add or not though.

I've also been thinking about adding a dedicated config subcommand which would all end user to dump either the currently loaded config or one that would get loaded on init, which potentially would allow later addition of config migrate between releases and would negate the need for Default Config section. But that's for a different time, with it's own proposal and as companion to settings rework so just throwing it out there.

@wxiaoguang
Copy link
Contributor

IMO the "DEFAULT CONFIGURATION:" section is just a legacy design that we don't want to break (at the moment it is the only approach to see where the config file is, for example: in docker, there is a shell wrapper)

As long as there is no breaking, we can still keep "DEFAULT CONFIGURATION:" section for some time, until we would have some better designs.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 10, 2025
@wxiaoguang wxiaoguang merged commit 4b174e4 into go-gitea:main Jul 10, 2025
26 checks passed
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jul 11, 2025
* giteaofficial/main:
  Fix updating user visibility (go-gitea#35036)
  Fix git commit committer parsing and add some tests (go-gitea#35007)
  Refactor OpenIDConnect to support SSH/FullName sync (go-gitea#34978)
  Support base64-encoded agit push options (go-gitea#35037)
  Also display "recently pushed branch" alert on PR view (go-gitea#35001)
  Make submodule link work with relative path (go-gitea#35034)
  Update to go 1.24.5 (go-gitea#35031)
  Improve CLI commands (go-gitea#34973)
  Tweak eslint config, fix new issues (go-gitea#35019)

# Conflicts:
#	templates/repo/commits_list.tmpl
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Oct 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. 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 type/enhancement An improvement of existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants