summaryrefslogtreecommitdiff
path: root/xmake/scripts/profile-win.ps1
diff options
context:
space:
mode:
authorxq114 <[email protected]>2023-01-16 13:03:16 +0800
committerxq114 <[email protected]>2023-01-16 13:03:16 +0800
commiteeed327070129470469f7d78028fe0e8caba1e2c (patch)
tree427c7f84a6616bfdd3ccbd34558e0261d8869b4f /xmake/scripts/profile-win.ps1
parent130a8e4d62be37e6696c90015a70d6f6d0b225da (diff)
update profiles
Diffstat (limited to 'xmake/scripts/profile-win.ps1')
-rw-r--r--xmake/scripts/profile-win.ps122
1 files changed, 20 insertions, 2 deletions
diff --git a/xmake/scripts/profile-win.ps1 b/xmake/scripts/profile-win.ps1
index 493543040..f19c48233 100644
--- a/xmake/scripts/profile-win.ps1
+++ b/xmake/scripts/profile-win.ps1
@@ -7,8 +7,26 @@ Register-ArgumentCompleter -Native -CommandName xmake -ScriptBlock {
}
$oldenv = $env:XMAKE_SKIP_HISTORY
$env:XMAKE_SKIP_HISTORY = 1
- xmake lua --root private.utils.complete "0" "nospace" "$complete" | ForEach-Object {
- [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
+ xmake lua "private.utils.complete" $cursorPosition "nospace-json" "$complete" | ConvertFrom-Json | Sort-Object -Property value | ForEach-Object {
+ $hasdesc = [bool] $_.psobject.Properties['description']
+ $desc = $hasdesc ? " - $($_.description)" : ""
+ [System.Management.Automation.CompletionResult]::new($_.value, "$($_.value)$desc", 'ParameterValue', $_.value)
+ }
+ $env:XMAKE_SKIP_HISTORY = $oldenv
+}
+# PowerShell parameter completion for xrepo
+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 "private.xrepo.complete" $cursorPosition "nospace-json" "$complete" | ConvertFrom-Json | Sort-Object -Property value | ForEach-Object {
+ $hasdesc = [bool] $_.psobject.Properties['description']
+ $desc = $hasdesc ? " - $($_.description)" : ""
+ [System.Management.Automation.CompletionResult]::new($_.value, "$($_.value)$desc", 'ParameterValue', $_.value)
}
$env:XMAKE_SKIP_HISTORY = $oldenv
} \ No newline at end of file