Commit graph

26 commits

Author SHA1 Message Date
Mavaddat Javid
955cac7eb9
ignore resolve errors 2023-10-30 11:48:03 -04:00
Mavaddat Javid
94243fef09
need description property 2023-10-30 11:44:11 -04:00
Mavaddat Javid
c901861b50
Update powershell_completions.go
Typo in previous. Change `$_` PSItem to `$__%[2]sCmd`
2023-10-29 18:47:11 -04:00
Mavaddat Javid
caeed9f2a4
Update powershell_completions.go
Incorporate @bartoncasey insight about typical alias usage in https://github.com/spf13/cobra/pull/2049
2023-10-29 17:00:24 -04:00
Mavaddat Javid
f43b653d17
Update powershell_completions.go
Preliminary assignment before use
2023-06-19 16:56:55 -04:00
Mavaddat Javid
d17f539906
Merge branch 'main' into patch-1 2023-06-19 16:46:04 -04:00
Mavaddat Javid
0676e2612e
Update powershell_completions.go
Implement curly bracket technique like https://github.com/spf13/cobra/pull/1960
2023-06-19 16:44:38 -04:00
Paul Holzinger
fdee73b4a0
powershell: escape variable with curly brackets (#1960)
This fixes an issue with program names that include a dot, in our case
`podman.exe`. This was caused by the change in commit 6ba7ebbc.

Fixes #1853

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-06-19 12:16:18 -04:00
Mavaddat Javid
cc6f7e0edd
Forgot about the original alias!
In my exuberance to include all the other aliases, I accidentally removed the original alias that was previously the only one being registered for autocompletion. I have restored this `'%[1]s'`.
2023-06-14 11:58:34 -04:00
Mavaddat Javid
a6a563d656
completers ∀x∈ {cmds, aliases} in powershell_completions.go
pwsh completers ∀x∈ {cmds, aliases}
2023-06-12 10:46:19 -04:00
Unai Martinez-Corral
9e6b58afc7
update copyright year (#1927) 2023-03-05 21:28:31 -05:00
Oldřich Jedlička
567ea8ebc9
Add support for PowerShell 7.2+ (#1916)
PowerShell 7.2 has changed the way arguments are passed to executables.
This was originally an experimental feature in 7.2, but as of 7.3 it is
built-in. A simple "" is now sufficient for passing empty arguments, no
back-tick escaping is required.

Fixes #1849

Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
Co-authored-by: Oldřich Jedlička <oldrich.jedlicka@rohlik.cz>
2023-02-25 16:30:37 -05:00
Gyanendra Mishra
3daa4b9c36
Add keeporder to shell completion (#1903)
This allows programs to request the shell to maintain the order of completions that was returned by the program
2023-02-25 15:57:12 -05:00
Norman Dankert
c6b9971923
fix: force ForEach-Object to return array in pwsh completion (#1850)
Fixes #1847
2022-11-25 15:47:20 -05:00
Marc Khouzam
d4040ad8db
Allow user to add completion for powershell alias (#1621)
When a user has an alias in powershell, she will need to register that
alias for completion.  To make that possible, we store the completion
logic into a scriptblock variable which can easily be accessed by the
user to register aliases.

For example, if the user defines an alias for `helm`:
   PS> sal h helm
she will need to register the alias like so:
   PS> Register-ArgumentCompleter -CommandName 'h' -ScriptBlock $__helmCompleterBlock

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2022-10-03 13:06:04 -04:00
Unai Martinez-Corral
6d978a911e
add missing license headers (#1809) 2022-09-16 07:55:56 -04:00
Marc Khouzam
f464d6c82e
Add Active Help support (#1482) 2022-06-15 20:08:16 -04:00
Stefan Weil
1854bb5c96
Fix some typos (mostly found by codespell) (#1514)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-12-07 16:06:52 -07:00
Sebastiaan van Stijn
507caf5ac8
completions: fix mixed tab/spaces indentation (#1473)
These templates use 4 spaces for indentation, but some lines
used tabs.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-12-07 15:57:57 -07:00
tamo
4590150168
Correcting misspelled words (#1349)
* Correcting Misspelled Words
* grammar fixes
2021-05-10 17:19:33 -06:00
Paul Holzinger
7223a997c8
powershell completion fix no file comp directive (#1363)
Make sure to filter the returned completions before we check if
there are valid completions left.

Fixes #1362

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-05-03 10:25:30 -06:00
Paul Holzinger
ded486a867
Fix trailing whitespace in the powershell completion script (#1342)
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-02-14 10:27:21 -07:00
Anthony Fok
07445ea179
Copyedit shell-completion related documentation 2021-02-09 14:08:42 -07:00
Unai Martinez-Corral
652c755d37
Use golangci-lint (#1044)
Use golangci-lint. Repair warnings and errors resulting from linting.
2021-02-07 17:08:50 -07:00
Paul Holzinger
a4ab3fa09e
powershell completion with custom comp (#1208)
The current powershell completion is not very capable.

Let's port it to the go custom completion logic to have a
unified experience accross all shells.

Powershell supports three different completion modes

- TabCompleteNext (default windows style - on each key press the next option is displayed)
- Complete (works like bash)
- MenuComplete (works like zsh)

You set the mode with `Set-PSReadLineKeyHandler -Key Tab -Function <mode>`

To keep it backwards compatible `GenPowerShellCompletion` will not display descriptions.
Use `GenPowerShellCompletionWithDesc` instead. Descriptions will only be displayed with
`MenuComplete` or `Complete`.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-12-29 07:57:32 -07:00
Jan Kuehle
21ccc7b307 Add basic PowerShell completions 2019-06-07 10:26:08 -04:00