mirror of
https://github.com/spf13/cobra.git
synced 2024-12-23 20:15:21 -07:00
More documentation work for nushell
This commit is contained in:
parent
1886f6baad
commit
ddb39920b4
@ -848,21 +848,20 @@ to your powershell profile.
|
||||
Long: fmt.Sprintf(`Generate the autocompletion script for nushell.
|
||||
|
||||
To configure the Nushell cobra external completer for the first time:
|
||||
# 1. Copy the output of the command below:
|
||||
> %[1]s completion nushell
|
||||
# 2. Edit the nushell config file:
|
||||
> config nu
|
||||
# 3. Paste above the "let-env config" line.
|
||||
# 4. Change the config block's external_completer line to be external_completer: $cobra_completer
|
||||
# 5. You will need to start a new shel for this setup to take effect.
|
||||
|
||||
If you have already setup the cobra external completer for other Cobra-based applications:
|
||||
# 1. Edit the nushell config file:
|
||||
> config nu
|
||||
# 2. Modify the cobra_apps variable to contain this new application:
|
||||
> let cobra_apps = [ "othercobraapp", "%[1]s" ]
|
||||
# 3. You will need to start a new shell for this setup to take effect.
|
||||
`, c.Root().Name()),
|
||||
# 2. Copy the completer to at the end of the file.
|
||||
# 3. Add a section like the following below at the end of the file:
|
||||
$env.config.completions.external = {
|
||||
enable: true
|
||||
max_results: 100
|
||||
completer: $cobra_completer
|
||||
}
|
||||
|
||||
NOTE: This completer will work for all cobra based commands.
|
||||
More information can be found in the External Completions (https://www.nushell.sh/book/custom_completions.html#custom-descriptions) section of the Nushell book.
|
||||
Information on setting up more than one external completer can be found in the Multiple completer (https://www.nushell.sh/cookbook/external_completers.html#multiple-completer) section of the Nushell cookbook.
|
||||
`),
|
||||
Args: NoArgs,
|
||||
ValidArgsFunction: NoFileCompletions,
|
||||
RunE: func(cmd *Command, args []string) error {
|
||||
|
@ -1,4 +0,0 @@
|
||||
## Generating Nushell Completions For Your cobra.Command
|
||||
|
||||
Please refer to [Shell Completions](shell_completions.md) for details.
|
||||
|
@ -83,7 +83,9 @@ Nushell:
|
||||
completer: $cobra_completer
|
||||
}
|
||||
|
||||
NOTE: This completer will work for all cobra based commands. More information can be found in the External Completions (https://www.nushell.sh/book/custom_completions.html#custom-descriptions) section of the Nushell book. Information on setting up more than one external completer can be found in the Multiple completer (https://www.nushell.sh/cookbook/external_completers.html#multiple-completer) section of the Nushell cookbook.
|
||||
NOTE: This completer will work for all cobra based commands.
|
||||
More information can be found in the External Completions (https://www.nushell.sh/book/custom_completions.html#custom-descriptions) section of the Nushell book.
|
||||
Information on setting up more than one external completer can be found in the Multiple completer (https://www.nushell.sh/cookbook/external_completers.html#multiple-completer) section of the Nushell cookbook.
|
||||
|
||||
`,cmd.Root().Name()),
|
||||
DisableFlagsInUseLine: true,
|
||||
|
3
site/content/completions/nushell_completions.md
Normal file
3
site/content/completions/nushell_completions.md
Normal file
@ -0,0 +1,3 @@
|
||||
## Generating Nushell Completions For Your cobra.Command
|
||||
|
||||
Please refer to [Shell Completions](_index.md#nushell-completions) for details.
|
Loading…
Reference in New Issue
Block a user