Skip to content

Commit 37f00f9

Browse files
edvilmedsplaisted
authored andcommitted
Update Completions
1 parent 1beb4bb commit 37f00f9

File tree

3 files changed

+82
-33
lines changed

3 files changed

+82
-33
lines changed

test/dotnet.Tests/CompletionTests/snapshots/bash/DotnetCliSnapshotTests.VerifyCompletions.verified.sh

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ _testhost_tool() {
15841584
prev="${COMP_WORDS[COMP_CWORD-1]}"
15851585
COMPREPLY=()
15861586

1587-
opts="install uninstall update list run search restore --help"
1587+
opts="install uninstall update list run search restore execute --help"
15881588

15891589
if [[ $COMP_CWORD == "$1" ]]; then
15901590
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
@@ -1627,6 +1627,11 @@ _testhost_tool() {
16271627
return
16281628
;;
16291629

1630+
(execute)
1631+
_testhost_tool_execute $(($1+1))
1632+
return
1633+
;;
1634+
16301635
esac
16311636

16321637
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
@@ -1729,24 +1734,13 @@ _testhost_tool_run() {
17291734
prev="${COMP_WORDS[COMP_CWORD-1]}"
17301735
COMPREPLY=()
17311736

1732-
opts="--allow-roll-forward --from-source --configfile --source --add-source --verbosity --interactive --yes --ignore-failed-sources --help"
1737+
opts="--allow-roll-forward --help"
17331738

17341739
if [[ $COMP_CWORD == "$1" ]]; then
17351740
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
17361741
return
17371742
fi
17381743

1739-
case $prev in
1740-
--verbosity|-v)
1741-
COMPREPLY=( $(compgen -W "d detailed diag diagnostic m minimal n normal q quiet" -- "$cur") )
1742-
return
1743-
;;
1744-
--yes|-y)
1745-
COMPREPLY=( $(compgen -W "(${COMP_WORDS[0]} complete --position ${COMP_POINT} ${COMP_LINE} 2>/dev/null | tr '\n' ' ')" -- "$cur") )
1746-
return
1747-
;;
1748-
esac
1749-
17501744
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
17511745
}
17521746

@@ -1792,6 +1786,34 @@ _testhost_tool_restore() {
17921786
}
17931787

17941788

1789+
_testhost_tool_execute() {
1790+
1791+
cur="${COMP_WORDS[COMP_CWORD]}"
1792+
prev="${COMP_WORDS[COMP_CWORD-1]}"
1793+
COMPREPLY=()
1794+
1795+
opts="--allow-roll-forward --prerelease --configfile --source --add-source --ignore-failed-sources --interactive --yes --verbosity --help"
1796+
1797+
if [[ $COMP_CWORD == "$1" ]]; then
1798+
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
1799+
return
1800+
fi
1801+
1802+
case $prev in
1803+
--yes|-y)
1804+
COMPREPLY=( $(compgen -W "(${COMP_WORDS[0]} complete --position ${COMP_POINT} ${COMP_LINE} 2>/dev/null | tr '\n' ' ')" -- "$cur") )
1805+
return
1806+
;;
1807+
--verbosity|-v)
1808+
COMPREPLY=( $(compgen -W "d detailed diag diagnostic m minimal n normal q quiet" -- "$cur") )
1809+
return
1810+
;;
1811+
esac
1812+
1813+
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
1814+
}
1815+
1816+
17951817
_testhost_vstest() {
17961818

17971819
cur="${COMP_WORDS[COMP_CWORD]}"

test/dotnet.Tests/CompletionTests/snapshots/pwsh/DotnetCliSnapshotTests.VerifyCompletions.verified.ps1

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,8 @@ Register-ArgumentCompleter -Native -CommandName 'testhost' -ScriptBlock {
959959
[CompletionResult]::new('run', 'run', [CompletionResultType]::ParameterValue, "Run a local tool. Note that this command cannot be used to run a global tool. ")
960960
[CompletionResult]::new('search', 'search', [CompletionResultType]::ParameterValue, "Search dotnet tools in nuget.org")
961961
[CompletionResult]::new('restore', 'restore', [CompletionResultType]::ParameterValue, "Restore tools defined in the local tool manifest.")
962+
[CompletionResult]::new('execute', 'execute', [CompletionResultType]::ParameterValue, "Execute a tool command from source")
963+
[CompletionResult]::new('execute', 'exec', [CompletionResultType]::ParameterValue, "Execute a tool command from source")
962964
)
963965
$completions += $staticCompletions
964966
break
@@ -1057,16 +1059,6 @@ Register-ArgumentCompleter -Native -CommandName 'testhost' -ScriptBlock {
10571059
'testhost;tool;run' {
10581060
$staticCompletions = @(
10591061
[CompletionResult]::new('--allow-roll-forward', '--allow-roll-forward', [CompletionResultType]::ParameterName, "Allow a .NET tool to roll forward to newer versions of the .NET runtime if the runtime it targets isn`'t installed.")
1060-
[CompletionResult]::new('--from-source', '--from-source', [CompletionResultType]::ParameterName, "Executes a tool from source without permanently installing it. ")
1061-
[CompletionResult]::new('--configfile', '--configfile', [CompletionResultType]::ParameterName, "The NuGet configuration file to use.")
1062-
[CompletionResult]::new('--source', '--source', [CompletionResultType]::ParameterName, "Replace all NuGet package sources to use during installation with these.")
1063-
[CompletionResult]::new('--add-source', '--add-source', [CompletionResultType]::ParameterName, "Add an additional NuGet package source to use during installation.")
1064-
[CompletionResult]::new('--verbosity', '--verbosity', [CompletionResultType]::ParameterName, "Set the MSBuild verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].")
1065-
[CompletionResult]::new('--verbosity', '-v', [CompletionResultType]::ParameterName, "Set the MSBuild verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].")
1066-
[CompletionResult]::new('--interactive', '--interactive', [CompletionResultType]::ParameterName, "Allows the command to stop and wait for user input or action (for example to complete authentication).")
1067-
[CompletionResult]::new('--yes', '--yes', [CompletionResultType]::ParameterName, "Overrides confirmation prompt with `"yes`" value. ")
1068-
[CompletionResult]::new('--yes', '-y', [CompletionResultType]::ParameterName, "Overrides confirmation prompt with `"yes`" value. ")
1069-
[CompletionResult]::new('--ignore-failed-sources', '--ignore-failed-sources', [CompletionResultType]::ParameterName, "Treat package source failures as warnings.")
10701062
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, "Show command line help.")
10711063
[CompletionResult]::new('--help', '-h', [CompletionResultType]::ParameterName, "Show command line help.")
10721064
)
@@ -1102,6 +1094,25 @@ Register-ArgumentCompleter -Native -CommandName 'testhost' -ScriptBlock {
11021094
$completions += $staticCompletions
11031095
break
11041096
}
1097+
'testhost;tool;execute' {
1098+
$staticCompletions = @(
1099+
[CompletionResult]::new('--allow-roll-forward', '--allow-roll-forward', [CompletionResultType]::ParameterName, "Allow a .NET tool to roll forward to newer versions of the .NET runtime if the runtime it targets isn`'t installed.")
1100+
[CompletionResult]::new('--prerelease', '--prerelease', [CompletionResultType]::ParameterName, "Include pre-release packages.")
1101+
[CompletionResult]::new('--configfile', '--configfile', [CompletionResultType]::ParameterName, "The NuGet configuration file to use.")
1102+
[CompletionResult]::new('--source', '--source', [CompletionResultType]::ParameterName, "Replace all NuGet package sources to use during installation with these.")
1103+
[CompletionResult]::new('--add-source', '--add-source', [CompletionResultType]::ParameterName, "Add an additional NuGet package source to use during installation.")
1104+
[CompletionResult]::new('--ignore-failed-sources', '--ignore-failed-sources', [CompletionResultType]::ParameterName, "Treat package source failures as warnings.")
1105+
[CompletionResult]::new('--interactive', '--interactive', [CompletionResultType]::ParameterName, "Allows the command to stop and wait for user input or action (for example to complete authentication).")
1106+
[CompletionResult]::new('--yes', '--yes', [CompletionResultType]::ParameterName, "Overrides confirmation prompt with `"yes`" value. ")
1107+
[CompletionResult]::new('--yes', '-y', [CompletionResultType]::ParameterName, "Overrides confirmation prompt with `"yes`" value. ")
1108+
[CompletionResult]::new('--verbosity', '--verbosity', [CompletionResultType]::ParameterName, "Set the MSBuild verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].")
1109+
[CompletionResult]::new('--verbosity', '-v', [CompletionResultType]::ParameterName, "Set the MSBuild verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].")
1110+
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, "Show command line help.")
1111+
[CompletionResult]::new('--help', '-h', [CompletionResultType]::ParameterName, "Show command line help.")
1112+
)
1113+
$completions += $staticCompletions
1114+
break
1115+
}
11051116
'testhost;vstest' {
11061117
$staticCompletions = @(
11071118
[CompletionResult]::new('--Platform', '--Platform', [CompletionResultType]::ParameterName, "--Platform")

test/dotnet.Tests/CompletionTests/snapshots/zsh/DotnetCliSnapshotTests.VerifyCompletions.verified.zsh

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,16 +1127,6 @@ _testhost() {
11271127
(run)
11281128
_arguments "${_arguments_options[@]}" : \
11291129
'--allow-roll-forward[Allow a .NET tool to roll forward to newer versions of the .NET runtime if the runtime it targets isn'\''t installed.]' \
1130-
'--from-source[Executes a tool from source without permanently installing it. ]' \
1131-
'--configfile=[The NuGet configuration file to use.]:FILE: ' \
1132-
'*--source=[Replace all NuGet package sources to use during installation with these.]:SOURCE: ' \
1133-
'*--add-source=[Add an additional NuGet package source to use during installation.]:ADDSOURCE: ' \
1134-
'--verbosity=[Set the MSBuild verbosity level. Allowed values are q\[uiet\], m\[inimal\], n\[ormal\], d\[etailed\], and diag\[nostic\].]:LEVEL:((d\:"d" detailed\:"detailed" diag\:"diag" diagnostic\:"diagnostic" m\:"m" minimal\:"minimal" n\:"n" normal\:"normal" q\:"q" quiet\:"quiet" ))' \
1135-
'-v=[Set the MSBuild verbosity level. Allowed values are q\[uiet\], m\[inimal\], n\[ormal\], d\[etailed\], and diag\[nostic\].]:LEVEL:((d\:"d" detailed\:"detailed" diag\:"diag" diagnostic\:"diagnostic" m\:"m" minimal\:"minimal" n\:"n" normal\:"normal" q\:"q" quiet\:"quiet" ))' \
1136-
'--interactive[Allows the command to stop and wait for user input or action (for example to complete authentication).]' \
1137-
'--yes[Overrides confirmation prompt with \"yes\" value. ]' \
1138-
'-y[Overrides confirmation prompt with \"yes\" value. ]' \
1139-
'--ignore-failed-sources[Treat package source failures as warnings.]' \
11401130
'--help[Show command line help.]' \
11411131
'-h[Show command line help.]' \
11421132
':commandName -- The command name of the tool to run.: ' \
@@ -1169,6 +1159,25 @@ _testhost() {
11691159
'-h[Show command line help.]' \
11701160
&& ret=0
11711161
;;
1162+
(execute)
1163+
_arguments "${_arguments_options[@]}" : \
1164+
'--allow-roll-forward[Allow a .NET tool to roll forward to newer versions of the .NET runtime if the runtime it targets isn'\''t installed.]' \
1165+
'--prerelease[Include pre-release packages.]' \
1166+
'--configfile=[The NuGet configuration file to use.]:FILE: ' \
1167+
'*--source=[Replace all NuGet package sources to use during installation with these.]:SOURCE: ' \
1168+
'*--add-source=[Add an additional NuGet package source to use during installation.]:ADDSOURCE: ' \
1169+
'--ignore-failed-sources[Treat package source failures as warnings.]' \
1170+
'--interactive[Allows the command to stop and wait for user input or action (for example to complete authentication).]' \
1171+
'--yes[Overrides confirmation prompt with \"yes\" value. ]' \
1172+
'-y[Overrides confirmation prompt with \"yes\" value. ]' \
1173+
'--verbosity=[Set the MSBuild verbosity level. Allowed values are q\[uiet\], m\[inimal\], n\[ormal\], d\[etailed\], and diag\[nostic\].]:LEVEL:((d\:"d" detailed\:"detailed" diag\:"diag" diagnostic\:"diagnostic" m\:"m" minimal\:"minimal" n\:"n" normal\:"normal" q\:"q" quiet\:"quiet" ))' \
1174+
'-v=[Set the MSBuild verbosity level. Allowed values are q\[uiet\], m\[inimal\], n\[ormal\], d\[etailed\], and diag\[nostic\].]:LEVEL:((d\:"d" detailed\:"detailed" diag\:"diag" diagnostic\:"diagnostic" m\:"m" minimal\:"minimal" n\:"n" normal\:"normal" q\:"q" quiet\:"quiet" ))' \
1175+
'--help[Show command line help.]' \
1176+
'-h[Show command line help.]' \
1177+
':packageId -- Package reference in the form of a package identifier like '\''Newtonsoft.Json'\'' or package identifier and version separated by '\''@'\'' like '\''[email protected]'\''.: ' \
1178+
'*::commandArguments -- arguments forwarded to the tool: ' \
1179+
&& ret=0
1180+
;;
11721181
esac
11731182
;;
11741183
esac
@@ -1795,6 +1804,7 @@ _testhost__tool_commands() {
17951804
'run:Run a local tool. Note that this command cannot be used to run a global tool. ' \
17961805
'search:Search dotnet tools in nuget.org' \
17971806
'restore:Restore tools defined in the local tool manifest.' \
1807+
'execute:Execute a tool command from source' \
17981808
)
17991809
_describe -t commands 'testhost tool commands' commands "$@"
18001810
}
@@ -1841,6 +1851,12 @@ _testhost__tool__restore_commands() {
18411851
_describe -t commands 'testhost tool restore commands' commands "$@"
18421852
}
18431853

1854+
(( $+functions[_testhost__tool__execute_commands] )) ||
1855+
_testhost__tool__execute_commands() {
1856+
local commands; commands=()
1857+
_describe -t commands 'testhost tool execute commands' commands "$@"
1858+
}
1859+
18441860
(( $+functions[_testhost__vstest_commands] )) ||
18451861
_testhost__vstest_commands() {
18461862
local commands; commands=()

0 commit comments

Comments
 (0)