void-linux / xbps

The X Binary Package System (XBPS)
https://voidlinux.org/xbps/
Other
769 stars 122 forks source link

Argument Handling in XBPS Query's Remote Search #502

Open BlindRepublic opened 1 year ago

BlindRepublic commented 1 year ago

When using xbps-query with the -s switch, the query must be placed after the argument, unlike other arguments as far as I can tell. For example, running xbps-query gimp -R works fine, producing the repo's information on the gimp package. However, running xbps-query gimp -Rs prints the binary's usage information as it doesn't understand the argument, requiring the command to be rearranged as xbps-query -Rs gimp. Seeing as this is a mode argument (in comparison to something like --property that conceptually requires a specific argument following it), the order should not matter as with other package managers that use a similar system like pacman on Arch.

Sorry if this explanation is a bit verbose. Let me know if there's anything I can clarify.

classabbyamp commented 1 year ago

that's because -s requires an argument, it's not just a flag

from xbps-query(1):

-s, --search PATTERN [--repository] [--property PROP] [--regex]

BlindRepublic commented 1 year ago

that's because -s requires an argument, it's not just a flag.

I am aware of how it currently works. I meant that this structuring adds micromanagement when using the shell that isn't structurally necessary, particularly with mistakes.

For example, if you type xbps-query pkg and the actual name of pkg is pkg-a and you want to search it, it adds some unnecessary backspaces or whatever key presses are needed to reorder. If it were designed as a flag, you could just use shell history and add -s. Furthermore, changing this wouldn't break anything from a user's perspective as there isn't any reason you would run xbps-query pkg1 -s pkg2 or the like, since this already throws an error.

I should've conveyed that this isn't necessarily a bug, but more of an enhancement. I'm willing to work on it myself if it's too minor.