mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
refactor(completion): name path arguments explicitly and share firstArg
The six commands that take a file or directory argument set their completer directly instead of a Use-line parser wrapping every command, the first-argument-only wrappers become one firstArg helper, and only the bash completion help keeps a custom text. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
22 files changed
+75
-212
No files matched your search
@@ -426,13 +426,7 @@ func article(noun string) string {
|
||||
// completeDiscussions completes the open issues or pull requests that a command of kind takes.
|
||||
func (a *application) completeDiscussions(kind refKind) cobra.CompletionFunc {
|
||||
if kind == pullRef {
|
||||
complete := a.completePulls("open")
|
||||
return func(cmd *cobra.Command, args []string, toComplete string) ([]cobra.Completion, cobra.ShellCompDirective) {
|
||||
if len(args) > 0 {
|
||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
return complete(cmd, args, toComplete)
|
||||
}
|
||||
return firstArg(a.completePulls("open"))
|
||||
}
|
||||
return a.completeIssueArgs("open", false)
|
||||
return firstArg(a.completeIssues("open"))
|
||||
}
|
||||
Reference in new issue
Block a user