a few small code cleanups

This commit is contained in:
jonsequitur 2017-03-06 12:08:26 -08:00
parent 5f227c1c45
commit 6b66db7436
4 changed files with 10 additions and 10 deletions

View file

@ -1,14 +1,13 @@
#!/bin/bash #!/bin/bash
# Parameter completion for the dotnet CLI # bash parameter completion for the dotnet CLI
_dotnet_bash_complete() _dotnet_bash_complete()
{ {
local word=${COMP_WORDS[COMP_CWORD]} local word=${COMP_WORDS[COMP_CWORD]}
local dotnetPath=${COMP_WORDS[1]} local dotnetPath=${COMP_WORDS[1]}
local completions=("$(./bin/Debug/netcoreapp1.0/osx.10.11-x64/publish/dotnet complete --position ${COMP_POINT} "${COMP_LINE}")") local completions=("$(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") ) COMPREPLY=( $(compgen -W "$completions" -- "$word") )
} }

View file

@ -1,6 +1,7 @@
# PowerShell parameter completion shim for the dotnet CLI
Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock { Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition) param($commandName, $wordToComplete, $cursorPosition)
C:\dev\github\cli\artifacts\win10-x64\stage2\dotnet.exe complete --position $cursorPosition "$wordToComplete" | ForEach-Object { dotnet.exe complete --position $cursorPosition "$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
} }
} }

View file

@ -1,10 +1,10 @@
# Parameter completion for the dotnet CLI # zsh parameter completion for the dotnet CLI
_dotnet_zsh_complete() _dotnet_zsh_complete()
{ {
local dotnetPath=$words[1] local dotnetPath=$words[1]
local completions=("$(./bin/Debug/netcoreapp1.0/osx.10.11-x64/publish/dotnet complete "$words")") local completions=("$(dotnet complete "$words")")
reply=( "${(ps:\n:)completions}" ) reply=( "${(ps:\n:)completions}" )
} }

View file

@ -15,10 +15,10 @@ namespace Microsoft.DotNet.Cli
public static Option VerbosityOption() => public static Option VerbosityOption() =>
Create.Option("-v|--verbosity", Create.Option("-v|--verbosity",
"Set the verbosity level of the command. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]", "Set the verbosity level of the command. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]",
Accept.AnyOneOf("quiet", Accept.AnyOneOf("q", "quiet",
"minimal", "m", "minimal",
"normal", "n", "normal",
"detailed")); "d", "detailed"));
public static ArgumentsRule DefaultToCurrentDirectory(this ArgumentsRule rule) => public static ArgumentsRule DefaultToCurrentDirectory(this ArgumentsRule rule) =>
rule.With(defaultValue: () => PathUtility.EnsureTrailingSlash(Directory.GetCurrentDirectory())); rule.With(defaultValue: () => PathUtility.EnsureTrailingSlash(Directory.GetCurrentDirectory()));