mirror of
https://github.com/nushell/nushell.git
synced 2024-12-23 15:39:06 +01:00
Put completions in their own module (#4880)
This commit is contained in:
parent
bd5778fa24
commit
d5f23ab592
@ -54,6 +54,7 @@ let-env NU_PLUGIN_DIRS = [
|
|||||||
($nu.config-path | path dirname | path join 'plugins')
|
($nu.config-path | path dirname | path join 'plugins')
|
||||||
]
|
]
|
||||||
|
|
||||||
|
module completions {
|
||||||
# Custom completions for external commands (those outside of Nushell)
|
# Custom completions for external commands (those outside of Nushell)
|
||||||
# Each completions has two parts: the form of the external command, including its flags and parameters
|
# Each completions has two parts: the form of the external command, including its flags and parameters
|
||||||
# and a helper command that knows how to complete values for those flags and parameters
|
# and a helper command that knows how to complete values for those flags and parameters
|
||||||
@ -67,7 +68,7 @@ def "nu-complete git remotes" [] {
|
|||||||
^git remote | lines | each { |line| $line | str trim }
|
^git remote | lines | each { |line| $line | str trim }
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "git checkout" [
|
export extern "git checkout" [
|
||||||
branch?: string@"nu-complete git branches" # name of the branch to checkout
|
branch?: string@"nu-complete git branches" # name of the branch to checkout
|
||||||
-b: string # create and checkout a new branch
|
-b: string # create and checkout a new branch
|
||||||
-B: string # create/reset and checkout a branch
|
-B: string # create/reset and checkout a branch
|
||||||
@ -92,7 +93,7 @@ extern "git checkout" [
|
|||||||
--pathspec-from-file: string # read pathspec from file
|
--pathspec-from-file: string # read pathspec from file
|
||||||
]
|
]
|
||||||
|
|
||||||
extern "git push" [
|
export extern "git push" [
|
||||||
remote?: string@"nu-complete git remotes", # the name of the remote
|
remote?: string@"nu-complete git remotes", # the name of the remote
|
||||||
refspec?: string@"nu-complete git branches"# the branch / refspec
|
refspec?: string@"nu-complete git branches"# the branch / refspec
|
||||||
--verbose(-v) # be more verbose
|
--verbose(-v) # be more verbose
|
||||||
@ -121,6 +122,10 @@ extern "git push" [
|
|||||||
--ipv4(-4) # use IPv4 addresses only
|
--ipv4(-4) # use IPv4 addresses only
|
||||||
--ipv6(-6) # use IPv6 addresses only
|
--ipv6(-6) # use IPv6 addresses only
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get just the extern definitions without the custom completion commands
|
||||||
|
use completions *
|
||||||
|
|
||||||
# for more information on themes see
|
# for more information on themes see
|
||||||
# https://github.com/nushell/nushell/blob/main/docs/How_To_Coloring_and_Theming.md
|
# https://github.com/nushell/nushell/blob/main/docs/How_To_Coloring_and_Theming.md
|
||||||
|
Loading…
Reference in New Issue
Block a user