diff --git a/bin/windows/create_completion_files.ps1 b/bin/windows/create_completion_files.ps1 index e6579ca..57f0bfa 100644 --- a/bin/windows/create_completion_files.ps1 +++ b/bin/windows/create_completion_files.ps1 @@ -14,3 +14,6 @@ rustup completions powershell > (Join-Path $script_location "rustup_completion.p wezterm shell-completion --shell power-shell > (Join-Path $script_location "wezterm_completion.ps1") chezmoi completion powershell > (Join-Path $script_location "chezmoi_completion.ps1") +# alias +Set-Location $PSScriptRoot +Get-ChildItem "../../extra_configs/completions" -File | Copy-Item -Destination $script_location diff --git a/extra_configs/completions/.gitignore b/extra_configs/completions/.gitignore new file mode 100644 index 0000000..eb537a5 --- /dev/null +++ b/extra_configs/completions/.gitignore @@ -0,0 +1 @@ +help_txt/ \ No newline at end of file diff --git a/extra_configs/completions/tree_completion.ps1 b/extra_configs/completions/tree_completion.ps1 new file mode 100644 index 0000000..6d5c018 --- /dev/null +++ b/extra_configs/completions/tree_completion.ps1 @@ -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) + } + } +}