introduce dotnet complete command
This commit is contained in:
parent
2048940760
commit
d40a87bc44
9 changed files with 650 additions and 2 deletions
15
scripts/register-completions.bash
Normal file
15
scripts/register-completions.bash
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
# Parameter completion for the dotnet CLI
|
||||
|
||||
_dotnet_bash_complete()
|
||||
{
|
||||
local word=${COMP_WORDS[COMP_CWORD]}
|
||||
local dotnetPath=${COMP_WORDS[1]}
|
||||
|
||||
local completions=("$(./bin/Debug/netcoreapp1.0/osx.10.11-x64/publish/dotnet complete --position ${COMP_POINT} "${COMP_LINE}")")
|
||||
|
||||
# https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion-Builtins.html
|
||||
COMPREPLY=( $(compgen -W "$completions" -- "$word") )
|
||||
}
|
||||
|
||||
complete -f -F _dotnet_bash_complete dotnet
|
6
scripts/register-completions.ps1
Normal file
6
scripts/register-completions.ps1
Normal file
|
@ -0,0 +1,6 @@
|
|||
Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {
|
||||
param($commandName, $wordToComplete, $cursorPosition)
|
||||
C:\dev\github\cli\artifacts\win10-x64\stage2\dotnet.exe complete --position $cursorPosition "$wordToComplete" | ForEach-Object {
|
||||
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
||||
}
|
||||
}
|
12
scripts/register-completions.zsh
Normal file
12
scripts/register-completions.zsh
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Parameter completion for the dotnet CLI
|
||||
|
||||
_dotnet_zsh_complete()
|
||||
{
|
||||
local dotnetPath=$words[1]
|
||||
|
||||
local completions=("$(./bin/Debug/netcoreapp1.0/osx.10.11-x64/publish/dotnet complete "$words")")
|
||||
|
||||
reply=( "${(ps:\n:)completions}" )
|
||||
}
|
||||
|
||||
compctl -K _dotnet_zsh_complete dotnet
|
Loading…
Add table
Add a link
Reference in a new issue