Bug 1135986

Summary: RFE: teach bash completion about dnf plugins
Product: [Fedora] Fedora Reporter: Hans de Goede <hdegoede>
Component: dnf-plugins-coreAssignee: rpm-software-management
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: low    
Version: rawhideCC: amatej, jzeleny, packaging-team-maint, tim.lauridsen
Target Milestone: ---Keywords: FutureFeature, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-10 05:31:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hans de Goede 2014-09-01 12:03:21 UTC
dnf repo<tab><tab> does not show repoquery, it would be nice if it would.

Comment 1 Igor Gnatenko 2014-09-02 14:03:46 UTC
I'm re-writing bash-completion from scratch. this functionality will be added.

Comment 2 Igor Gnatenko 2014-09-02 14:08:17 UTC
Are we need bash-completion for plugins? or we just need repo<tab><tab> and nothing more for plugins?

Comment 3 Hans de Goede 2014-09-02 14:51:59 UTC
(In reply to Igor Gnatenko from comment #2)
> Are we need bash-completion for plugins? or we just need repo<tab><tab> and
> nothing more for plugins?

It would be nice if things like:
dnf repoquery --what<tab><tab>

Would also work, and basically the same for all core plugins. IOW it would ne nice to have full bash completion for commands provided by core plugins, just like the completion for buildins.

For repoquery see: http://dnf-plugins-core.readthedocs.org/en/latest/repoquery.html
And for the others see: http://dnf-plugins-core.readthedocs.org/en/latest/

Thanks,

Hans

Comment 4 Ales Kozumplik 2014-09-03 05:27:16 UTC
Igor note that at no cost we can create any kind of a dependency from core dnf to the plugins. If that proves to be the only way then you're welcome to CANTFIX this. Thanks!

Comment 5 Igor Gnatenko 2014-09-06 11:33:07 UTC
(In reply to Ales Kozumplik from comment #4)
> Igor note that at no cost we can create any kind of a dependency from core
> dnf to the plugins. If that proves to be the only way then you're welcome to
> CANTFIX this. Thanks!
What do you think about this solution?
Solution:
`dnf.cli.Command` class should have new optional field where we shoud provide initialized `ArgumentParser` class and if we invoke `dnf someplugin help` if this optional field provided we printing this. Or something like that.

Comment 6 Honza Silhan 2014-09-08 13:44:11 UTC
I had similar thought - implement ArgumentParser's subparser inside each Command. The problem is that DNF would be binded to ArgumentParser module which could be deprecated in feature. By refactoring it we would break all the plugins.

Comment 7 Tim Lauridsen 2014-09-08 15:02:48 UTC
I have played around with that, and it gives a lot of issues.

multiple plugins can't have the same options and a bad plugin, can stop dnf from working.

The current approch used in some plugins with each plugin setup a argument parser to parse the leftover arguments/option given by dnf to the plugin is much better.

But it gives som íssues for bash completion for plugins commands

Comment 8 Martin Kutlak 2018-06-04 16:52:56 UTC
PR:
https://github.com/rpm-software-management/dnf/pull/1102

Comment 9 Hans de Goede 2018-06-04 17:44:35 UTC
(In reply to Martin Kutlak from comment #8)
> PR:
> https://github.com/rpm-software-management/dnf/pull/1102

Awesome (note not tested) I will be so happy when I can use tab-completion on "dnf repoquery ..." commands :)

Thank you for your work on this.

Comment 11 Jaroslav Mracek 2023-08-10 05:31:05 UTC
The bash completion was improve, therefore closing bug as a resolved.