summaryrefslogtreecommitdiff
path: root/vendor/github.com/spf13/cobra/shell_completions.md
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2022-11-07 11:20:30 +0100
committerLibravatar GitHub <noreply@github.com>2022-11-07 11:20:30 +0100
commita5f31e5dd3a29145f63f4826fe4b79a7f0081e0f (patch)
tree1b8629286238d6df36f43e62c3325e0436ad86a8 /vendor/github.com/spf13/cobra/shell_completions.md
parent[chore] Bump github.com/go-playground/validator/v10 from 10.11.0 to 10.11.1 (... (diff)
downloadgotosocial-a5f31e5dd3a29145f63f4826fe4b79a7f0081e0f.tar.xz
[chore] Bump github.com/spf13/cobra from 1.5.0 to 1.6.1 (#982)
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.5.0 to 1.6.1. - [Release notes](https://github.com/spf13/cobra/releases) - [Commits](https://github.com/spf13/cobra/compare/v1.5.0...v1.6.1) --- updated-dependencies: - dependency-name: github.com/spf13/cobra dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/spf13/cobra/shell_completions.md')
-rw-r--r--vendor/github.com/spf13/cobra/shell_completions.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/vendor/github.com/spf13/cobra/shell_completions.md b/vendor/github.com/spf13/cobra/shell_completions.md
index 1e2058ed6..553ee5df8 100644
--- a/vendor/github.com/spf13/cobra/shell_completions.md
+++ b/vendor/github.com/spf13/cobra/shell_completions.md
@@ -99,6 +99,11 @@ To tell Cobra *not* to provide the default `completion` command:
rootCmd.CompletionOptions.DisableDefaultCmd = true
```
+To tell Cobra to mark the default `completion` command as *hidden*:
+```
+rootCmd.CompletionOptions.HiddenDefaultCmd = true
+```
+
To tell Cobra *not* to provide the user with the `--no-descriptions` flag to the completion sub-commands:
```
rootCmd.CompletionOptions.DisableNoDescFlag = true
@@ -530,6 +535,21 @@ search for a keyword in charts
$ helm s[tab]
search show status
```
+### Aliases
+
+You can also configure `powershell` aliases for your program and they will also support completions.
+
+```
+$ sal aliasname origcommand
+$ Register-ArgumentCompleter -CommandName 'aliasname' -ScriptBlock $__origcommandCompleterBlock
+
+# and now when you run `aliasname` completion will make
+# suggestions as it did for `origcommand`.
+
+$ aliasname <tab>
+completion firstcommand secondcommand
+```
+The name of the completer block variable is of the form `$__<programName>CompleterBlock` where every `-` and `:` in the program name have been replaced with `_`, to respect powershell naming syntax.
### Limitations