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
@@ -50,7 +50,7 @@ $ tea run artifact list 34`,
|
||||
},
|
||||
}
|
||||
pageFlags(list, &limit, &page)
|
||||
list.ValidArgsFunction = a.completeRunArg()
|
||||
list.ValidArgsFunction = firstArg(a.completeRuns())
|
||||
group.AddCommand(list)
|
||||
|
||||
return group
|
||||
@@ -148,7 +148,7 @@ $ tea run download 34 --zip`,
|
||||
destination.register(cmd)
|
||||
cmd.Flags().StringSliceVarP(&names, "name", "n", nil, "Only download the artifacts with these names")
|
||||
cmd.Flags().BoolVar(&asZip, "zip", false, "Save each artifact as a ZIP archive instead of extracting it")
|
||||
cmd.ValidArgsFunction = a.completeRunArg()
|
||||
cmd.ValidArgsFunction = firstArg(a.completeRuns())
|
||||
_ = cmd.RegisterFlagCompletionFunc("name", commaSeparated(a.completeArtifactNames()))
|
||||
return cmd
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user