mirror of
https://codeberg.org/qwjyh/dotfiles.git
synced 2025-06-27 03:39:20 +09:00
new: pwsh completion for tree.com
This commit is contained in:
parent
30052098eb
commit
9c25e36452
3 changed files with 30 additions and 0 deletions
26
extra_configs/completions/tree_completion.ps1
Normal file
26
extra_configs/completions/tree_completion.ps1
Normal file
|
@ -0,0 +1,26 @@
|
|||
# generate completion for tree.com
|
||||
# output help with UTF-8
|
||||
|
||||
"tree", "tree.com" | Foreach-Object {
|
||||
Register-ArgumentCompleter -Native -CommandName $_ -ScriptBlock {
|
||||
param($wordToComplete, $commandAst, $cursorPosition)
|
||||
|
||||
$commands = @{
|
||||
cmd = "/F"; desc = "Display the names of the files in each folder."
|
||||
}, @{
|
||||
cmd = "/A"; desc = "Use ASCII instead of extended characters."
|
||||
}
|
||||
|
||||
# [string[]]$list = if ([string]$wordToComplete -eq "") {
|
||||
# $commands
|
||||
# } else {
|
||||
# $commands | Where-Object {
|
||||
# $_.cmd -match $wordToComplete
|
||||
# }
|
||||
# }
|
||||
|
||||
$commands | ForEach-Object {
|
||||
[System.Management.Automation.CompletionResult]::new($_.cmd, $_.cmd, 'ParameterValue', $_.desc)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue