rpm-software-management / dnf5

Next-generation RPM package management system
Other
257 stars 87 forks source link

Hint when an unknown option is available on different commands #1858

Closed kontura closed 3 days ago

kontura commented 1 week ago

Closes: https://github.com/rpm-software-management/dnf5/issues/1830 Tests: https://github.com/rpm-software-management/ci-dnf-stack/pull/1593

jrohel commented 3 days ago

Thank you. This hint may help users.

Note: There is a problem with a group of several short arguments. For example:

# dnf -yl upgrade
Unknown argument "-yl" for command "dnf5". Add "--help" for more information about the arguments. 
The argument is available for commands: . (It has to be placed after the command.)

Instead of being told that the second argument 'l' is unknown (or in this case, that it is available for repoquery), the user is told the information for the first argument 'y', which is available globally (an empty command is displayed). But even so, this PR gives a helpful hint in other situations. To solve the above problem, it would want to extend the information provided by the argument parser.

I'll merge it.