Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ghost opened this issue Mar 3, 2023 · 2 comments
Open

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

ghost opened this issue Mar 3, 2023 · 2 comments
Labels

Comments

@ghost
Copy link

ghost commented Mar 3, 2023

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
Copy link
Author

ghost commented Mar 3, 2023

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

@fosskers fosskers added the bug label Mar 6, 2023
@fosskers
Copy link
Owner

fosskers commented Mar 6, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant