PSReadLine icon indicating copy to clipboard operation
PSReadLine copied to clipboard

Fish like abbreviations for auto expansion of aliases of command plus args

Open nebula-it opened this issue 3 years ago • 0 comments

Prerequisites

  • [X] Write a descriptive title.

Description of the new feature/enhancement

Currently, in pwsh if you want to make alias of a command + args you need to use a function. e.g

function kgpo() { & kubectl get pods $args }

However, the issue with this is that it breaks autocomplete. To get around this, can we have something similar to what fish does with abbreviations. In pwsh, we can do

New-Abbreviation -Name kgpo -Value 'kubectl get pods'

this will simply expand the chars kgpo as soon as those are typed, i.e once you type kgpo and hit space, and then standard autocomplete will take over if you hit tab.

It was discussed in https://github.com/PowerShell/PSReadLine/issues/1753 previously but that issue got closed. https://github.com/PowerShell/PowerShell/issues/12962 is another one from main powershell repo but as discussed, seems like this belongs to the realm of PSReadLine.

Proposed technical implementation details (optional)

No response

nebula-it avatar Apr 18 '22 05:04 nebula-it