aura icon indicating copy to clipboard operation
aura copied to clipboard

Option parsing issues with `--` delimiter (double dash, two dashes)

Open ghost opened this issue 2 years ago • 2 comments
trafficstars

i recently ran into an options parsing issue with aura when attempting to query the official repositories for -font.

Since the query -font starts with a dash -, i cannot run aura -Ss -font as it would be equivalent to aura -S -s -f -o -n -t, where every letter of the query is interpreted as an option. That means i need to signify the end of options, for -font to be treated as an operand. I'm used to doing this with --, but -- does not work for me in aura.

$ pacman -Ss -font
error: invalid option '-f'


$ pacman -Ss -- -font
community/ttf-terminus-nerd 2.3.3-2
    Patched font Terminus (Terminess) from nerd fonts library
community/ttf-tinos-nerd 2.3.3-2
    Patched font Tinos from nerd fonts library
community/ttf-ubuntu-font-family 0.83-8
    Ubuntu font family
community/ttf-ubuntu-mono-nerd 2.3.3-2


$ aura -Ss -- -font
error: invalid option '-f'

The -- behavior is present in pacman and many other cli programs, but is evidently missing in AURA Version 3.2.9.

References: Mentioned in bash(1) man-page under SHELL BUILTIN COMMANDS:

Unless otherwise noted, each builtin command documented in this section as accepting options preceded by - accepts -- to signify the end of the options.

And in the latest POSIX standard under 12. Utility Conventions->12.2 Utility Syntax Guidelines:

... Guideline 10: The first -- argument that is not an option-argument should be accepted as a delimiter indicating the end of options. Any following arguments should be treated as operands, even if they begin with the '-' character. ...

ghost avatar Mar 03 '23 02:03 ghost

aura 4.0.0-alpha6 suffers from the same bug, although the underlying cause is probably different, as -- seems to be recognized in some capacity.

$ aura --version
aura-pm 4.0.0-alpha6


$ aura -Ss -font
error: Found argument '-f' which wasn't expected, or isn't valid in this context

	If you tried to supply `-f` as a value rather than a flag, use `-- -f`

USAGE:
    aura {sync|--sync|-S} [OPTIONS] [PACKAGES]...

For more information try --help


$ aura -Ss -- -font
error: The argument '--search <terms>' requires a value but none was supplied

For more information try --help

ghost avatar Mar 03 '23 03:03 ghost

Confirmed that it also failed on Aura 4, even with -font wrapped in quotes! Attempts to use the long variant --search with = also didn't succeed.

fosskers avatar Mar 06 '23 02:03 fosskers

Hi there, I'm sorry that this took so long to address. It's now possible to do aura -Ss -- -font and get the output you were expecting.

fosskers avatar Jul 01 '24 00:07 fosskers