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
@@ -135,7 +135,7 @@ func sshKeySource(source string) string {
|
||||
func (a *application) sshKeyCreateCommand() *cobra.Command {
|
||||
var title string
|
||||
cmd := &cobra.Command{
|
||||
Use: "create [<file>]", Aliases: []string{"add"}, Short: "Add an SSH public key from a file or stdin", Args: usageArgs(cobra.MaximumNArgs(1)),
|
||||
Use: "create [<file>]", Aliases: []string{"add"}, Short: "Add an SSH public key from a file or stdin", Args: usageArgs(cobra.MaximumNArgs(1)), ValidArgsFunction: completeFiles,
|
||||
Long: `Add an SSH public key to your account. Without a file, or with -, the key is read from stdin.
|
||||
|
||||
The title defaults to the key's comment, such as alice@laptop, or else to this computer's name.`,
|
||||
|
||||
Reference in new issue
Block a user