Update ps1 completion#3365
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR updates the PowerShell completion script for bat to provide more descriptive and comprehensive tab completion functionality. The update removes shortcut entries and adds dynamic completions with individual values for languages, themes, and other command arguments.
- Replaced template placeholders with hardcoded "bat" command name
- Added dynamic completion functions for themes and languages with descriptive output
- Enhanced argument-specific completions with predefined value arrays for various options
Comments suppressed due to low confidence (1)
assets/completions/_bat.ps1.in:22
- The variable name '$themes' is misleading since this function processes languages, not themes. It should be named '$languages' for clarity.
$themes = bat --list-languages | ForEach-Object{[pscustomobject]@{MyParameter=$_.Substring(0,$_.IndexOf(":")).Trim();MyDescription=$_.Substring($_.IndexOf(":")+1)}} | select-object
| $element.Value -eq $wordToComplete) { | ||
| #-or $element.Value.StartsWith('-') |
There was a problem hiding this comment.
The condition logic appears incorrect. The original condition checked if the element starts with '-' OR equals $wordToComplete, but now it only checks equality. This could break command parsing logic.
| $element.Value -eq $wordToComplete) { | |
| #-or $element.Value.StartsWith('-') | |
| $element.Value -eq $wordToComplete -or $element.Value.StartsWith('-')) { |
There was a problem hiding this comment.
It seems like Copilot missed that it was commented out previously?
There was a problem hiding this comment.
changing back, would not complete the optional entries, I receive only the default part.
617dbcd to
2a92258
Compare
…ion for language, theme and options
changed back to Template Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2a92258 to
d4fc07a
Compare
Hi all,
Made an update to the default completion for ps1
Code completion, in powershell, should be more descriptive.
** Language
** Theme
** Other argument with options
Works with Powershell Core 7