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

Add bash-completion for core plugins (RhBug: 1135986) (RhBug:1425812) #1102

Closed

Conversation

mkutlak
Copy link
Contributor

@mkutlak mkutlak commented Jun 4, 2018

The completions are only shown if the python3-dnf-plugins-core is installed.

https://bugzilla.redhat.com/show_bug.cgi?id=1135986
https://bugzilla.redhat.com/show_bug.cgi?id=1425812

@m-blaha m-blaha self-assigned this Jun 5, 2018
@Conan-Kudo
Copy link
Member

Why aren't these being added to dnf-plugins-core instead? I'd rather have a way for our completion mechanism to easily hooked with more plugin completions.

@lukash
Copy link
Contributor

lukash commented Mar 7, 2019

@mkutlak looks good, thanks for the PR. However, it really should go into the dnf-plugins-core package.

The obvious handwavy solution is to add a dnf-plugins-core bashcomp file and look for it in the dnf bashcomp file. If present, it should be hooked into the _dnf() function.

Are you interested in doing this?

@lukash
Copy link
Contributor

lukash commented Mar 7, 2019

Also:

The completions are only shown if the dnf-plugins-core is installed.

How exactly does this work? No explicit check is present in the commits and it's not obvious to me.

@mkutlak
Copy link
Contributor Author

mkutlak commented Mar 7, 2019

Are you interested in doing this?

I am no longer interested in this.

The completions are only shown if the dnf-plugins-core is installed.

How exactly does this work? No explicit check is present in the commits and it's not obvious to me.

Apologies, it should say python3-dnf-plugins-core.

from _dnf_commands_helper()

helper_cmd="import sys; from dnf.cli import completion_helper as ch; ch.main(sys.argv[1:])"

This returns a list of all available dnf commands.

If you have python3-dnf-plugins-core on your system, the list will be expanded with commands from it.


With python3-d-p-c:

$ echo "$(python3 -c "import sys; from dnf.cli import completion_helper as ch; ch.main(sys.argv[1:])" "_cmds" "" "-d 0 -q -C --assumeno --nogpgcheck")" |wc -l
92

Without python3-d-p-c:

$ echo "$(python3 -c "import sys; from dnf.cli import completion_helper as ch; ch.main(sys.argv[1:])" "_cmds" "" "-d 0 -q -C --assumeno --nogpgcheck")" |wc -l
75

@lukash
Copy link
Contributor

lukash commented Mar 7, 2019

@mkutlak ok, thanks.

Not sure what to do with this PR then. The commits are valuable but need the work of moving them to dnf-plugins-core and integrating with dnf bash completion. I'm inclined to leave this open until someone gets around to do this.

@m-blaha
Copy link
Member

m-blaha commented Apr 17, 2019

I would like to have all options / parameters of dnf commands generated by the argparse python module. I mark this as "work in progress" for now.

@dmach
Copy link

dmach commented Aug 8, 2019

@lukash @m-blaha could you finish the review please?
It's been in the backlog for too long.

@sunwire
Copy link

sunwire commented Aug 11, 2020

Because it's hard to implement plugins in bash, maybe we will use python to implement autocomplete?
A little Proof of Concept https://github.com/sunwire/dnf_completion_poc
It implements builddep as a plugin.
It's only a concept, not a fully working program!
Only a few commands are implemented.
e.g.
alias -> (list, add, delete)
builddep -> (--spec, --srpm)

@mkutlak mkutlak closed this Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants