summaryrefslogtreecommitdiff
path: root/xmake/scripts/profile-win.ps1
diff options
context:
space:
mode:
authorruki <[email protected]>2026-03-26 00:04:01 +0800
committerruki <[email protected]>2026-03-26 00:04:01 +0800
commit887a080771e66e6488dfb68f16074dbeea461b25 (patch)
tree30b625504279bb00252cd5a11e2a12d7f371e36d /xmake/scripts/profile-win.ps1
parente3f123981d80c54af1b29b87a4a173557a51d73d (diff)
improve completions
Diffstat (limited to 'xmake/scripts/profile-win.ps1')
-rw-r--r--xmake/scripts/profile-win.ps110
1 files changed, 8 insertions, 2 deletions
diff --git a/xmake/scripts/profile-win.ps1 b/xmake/scripts/profile-win.ps1
index 201f291cd..a708a8893 100644
--- a/xmake/scripts/profile-win.ps1
+++ b/xmake/scripts/profile-win.ps1
@@ -6,8 +6,10 @@ Register-ArgumentCompleter -Native -CommandName xmake -ScriptBlock {
$complete = $complete + " "
}
$oldenv = $env:XMAKE_SKIP_HISTORY
+ $oldcolor = $env:XMAKE_COLORTERM
$env:XMAKE_SKIP_HISTORY = 1
- $results = xmake lua "private.utils.complete" $cursorPosition "nospace-json" "$complete" | ConvertFrom-Json | Sort-Object -Property value
+ $env:XMAKE_COLORTERM = "nocolor"
+ $results = xmake lua "private.utils.complete" $cursorPosition "nospace-json" "$complete" 2>$null | ConvertFrom-Json | Sort-Object -Property value
$results | ForEach-Object {
$hasdesc = [bool] $_.psobject.Properties['description']
if ($hasdesc) {
@@ -18,6 +20,7 @@ Register-ArgumentCompleter -Native -CommandName xmake -ScriptBlock {
[System.Management.Automation.CompletionResult]::new($_.value, "$($_.value)$desc", 'ParameterValue', $_.value)
}
$env:XMAKE_SKIP_HISTORY = $oldenv
+ $env:XMAKE_COLORTERM = $oldcolor
}
# PowerShell parameter completion for xrepo
@@ -28,8 +31,10 @@ Register-ArgumentCompleter -Native -CommandName xrepo -ScriptBlock {
$complete = $complete + " "
}
$oldenv = $env:XMAKE_SKIP_HISTORY
+ $oldcolor = $env:XMAKE_COLORTERM
$env:XMAKE_SKIP_HISTORY = 1
- $results = xmake lua "private.xrepo.complete" $cursorPosition "nospace-json" "$complete" | ConvertFrom-Json | Sort-Object -Property value
+ $env:XMAKE_COLORTERM = "nocolor"
+ $results = xmake lua "private.xrepo.complete" $cursorPosition "nospace-json" "$complete" 2>$null | ConvertFrom-Json | Sort-Object -Property value
$results | ForEach-Object {
$hasdesc = [bool] $_.psobject.Properties['description']
if ($hasdesc) {
@@ -40,4 +45,5 @@ Register-ArgumentCompleter -Native -CommandName xrepo -ScriptBlock {
[System.Management.Automation.CompletionResult]::new($_.value, "$($_.value)$desc", 'ParameterValue', $_.value)
}
$env:XMAKE_SKIP_HISTORY = $oldenv
+ $env:XMAKE_COLORTERM = $oldcolor
} \ No newline at end of file