diff options
author | Ville Skyttä <[email protected]> | 2024-04-07 20:33:17 +0000 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-04-11 15:34:26 +0200 |
commit | a67650b6f764d201fde22b1bc3c06b923fdc5438 (patch) | |
tree | 698bdb49baf78317ad506fcf8642a0f6da883543 /commands/deploy.go | |
parent | 2a060b37a32c3831ece2203b8b5451adb3c787af (diff) | |
download | hugo-a67650b6f764d201fde22b1bc3c06b923fdc5438.tar.gz hugo-a67650b6f764d201fde22b1bc3c06b923fdc5438.zip |
completion: Improve existing argument completions, add many more
Do not offer filenames to arguments not taking one, complete arguments
of options taking resource kinds, directory names, --logLevel, release
--step, config and new --format.
As an internal refactoring, use higher level functions to set flag
completions. SetAnnotation works, but is more verbose than
alternatives, and uses bash specific wording.
While at it, move setting completions next to flag definitions
consistently.
Remove superfluous --destination completer setting, which is already
set elsewhere.
Diffstat (limited to 'commands/deploy.go')
-rw-r--r-- | commands/deploy.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/commands/deploy.go b/commands/deploy.go index f5354f74d..873da14a4 100644 --- a/commands/deploy.go +++ b/commands/deploy.go @@ -60,13 +60,17 @@ documentation. return deployer.Deploy(ctx) }, withc: func(cmd *cobra.Command, r *rootCommand) { + cmd.ValidArgsFunction = cobra.NoFileCompletions cmd.Flags().String("target", "", "target deployment from deployments section in config file; defaults to the first one") + _ = cmd.RegisterFlagCompletionFunc("target", cobra.NoFileCompletions) cmd.Flags().Bool("confirm", false, "ask for confirmation before making changes to the target") cmd.Flags().Bool("dryRun", false, "dry run") cmd.Flags().Bool("force", false, "force upload of all files") cmd.Flags().Bool("invalidateCDN", deployconfig.DefaultConfig.InvalidateCDN, "invalidate the CDN cache listed in the deployment target") cmd.Flags().Int("maxDeletes", deployconfig.DefaultConfig.MaxDeletes, "maximum # of files to delete, or -1 to disable") + _ = cmd.RegisterFlagCompletionFunc("maxDeletes", cobra.NoFileCompletions) cmd.Flags().Int("workers", deployconfig.DefaultConfig.Workers, "number of workers to transfer files. defaults to 10") + _ = cmd.RegisterFlagCompletionFunc("workers", cobra.NoFileCompletions) }, } } |