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>
Use temporary files instead of assuming the current directory is
writable. Also, if creating a temporary file still returns an error,
prevent the test from failing silently by replacing `log.Fatal` with
`t.Fatal`.
The use in generated bash completion files is getting flagged by
Lintian (the Debian package linting tool).
Signed-off-by: Taavi Väänänen <hi@taavi.wtf>
Although it is not the recommended approach, sourcing a completion
script is the simplest way to get people to try using shell completion.
Not allowing it for zsh has turned out to complicate shell completion
adoption. Further, many tools modify the zsh script to allow sourcing.
This commit allows sourcing of the zsh completion script.
Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
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>
Fixes#1816
Previously, arguments with a dash as the second character (e.g., 1-ff00:0:1)
were detected as a flag by mistake. This resulted in auto completion misbehaving
if such an argument was last in the argument list during invocation.
When the command searches args to find the arg matching a
particular subcommand name, it needs to ignore flag values,
as it is possible that the value for a flag might match
the name of the sub command.
This change improves argsMinusFirstX() to ignore flag values
when it searches for the X to exclude from the result.
Fixes#1831
By moving the check for help group existence to "ExecuteC()" we no
longer need groups to be added before AddCommand() is called. This
provides more flexibility to developers and works better with the use
of "init()" for command creation.
Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
* use arithmetic evaluation in numeric context
* remove unnecessary $ from array index variables
* [[ ]] over [ ], == over =, remove unnecessary quoting
* use ${foo-} rather than ${foo:-} in emptiness check
The result of the expansion is null no matter if the variable is unset
or null in both cases; the former form is arguably easier on the eye.
* remove unnecessary trailing linefeed removal
No longer needed as of f464d6c82e, saves
a subshell.
* use herestring in activehelp extraction
Herestrings read cleaner than process substitutions, and work in posix
mode (but we do and will have some process substitutions so this doesn't
matter much). Both approaches may end up using temporary files.
* Add tests for grouping commands
* Adds Additional Command section in help
Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
Co-authored-by: Marc Khouzam <marc.khouzam@gmail.com>