summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorxq114 <[email protected]>2022-12-29 17:38:28 +0800
committerxq114 <[email protected]>2022-12-29 17:38:28 +0800
commit853efb1546bfebc8f529f4513543c2b269b2ef95 (patch)
treeafec70423a659ab596f3de40da5e85cca7820aed /scripts
parent26404ac83ca224c08f9db335f7cd1828b5d53538 (diff)
add xrepo completion for windows
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/register-completions.ps113
-rwxr-xr-xscripts/register-completions.sh2
2 files changed, 14 insertions, 1 deletions
diff --git a/scripts/register-completions.ps1 b/scripts/register-completions.ps1
index a9ecd7877..e54e38c16 100755
--- a/scripts/register-completions.ps1
+++ b/scripts/register-completions.ps1
@@ -13,3 +13,16 @@ Register-ArgumentCompleter -Native -CommandName xmake -ScriptBlock {
}
$env:XMAKE_SKIP_HISTORY = $oldenv
}
+Register-ArgumentCompleter -Native -CommandName xrepo -ScriptBlock {
+ param($commandName, $wordToComplete, $cursorPosition)
+ $complete = "$wordToComplete"
+ if (-not $commandName) {
+ $complete = $complete + " "
+ }
+ $oldenv = $env:XMAKE_SKIP_HISTORY
+ $env:XMAKE_SKIP_HISTORY = 1
+ xmake lua --root private.xrepo.complete "0" "nospace" "$complete" | ForEach-Object {
+ [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
+ }
+ $env:XMAKE_SKIP_HISTORY = $oldenv
+}
diff --git a/scripts/register-completions.sh b/scripts/register-completions.sh
index 40a8edac3..f3da05f10 100755
--- a/scripts/register-completions.sh
+++ b/scripts/register-completions.sh
@@ -16,7 +16,7 @@ if [[ "$SHELL" = */zsh ]]; then
local completions=("$(XMAKE_SKIP_HISTORY=1 XMAKE_ROOT=y xmake lua private.xrepo.complete 0 nospace "$words")")
reply=( "${(ps:\n:)completions}" )
}
- compctl -f -S "" -K _xrepo_zsh_complete xmake
+ compctl -f -S "" -K _xrepo_zsh_complete xrepo
elif [[ "$SHELL" = */bash ]]; then
# bash parameter completion for xmake