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

Zsh completion for bpftool #83

Open
qmonnet opened this issue Mar 17, 2023 · 6 comments
Open

Zsh completion for bpftool #83

qmonnet opened this issue Mar 17, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@qmonnet
Copy link
Member

qmonnet commented Mar 17, 2023

We have bash completion, but many users use Zsh nowadays.

Some other shells are in use as well (fish, ...), and could be candidates, although I'm not familiar with other completion systems.

Not sure if these would make it to the Linux repo, but alternatively we could host them on this mirror at least.

@qmonnet qmonnet added the enhancement New feature or request label Mar 17, 2023
@varun-r-mallya
Copy link

Please give me more details on this issue. I want to see if I can work on it.

@qmonnet
Copy link
Member Author

qmonnet commented Feb 11, 2025

Sure, we've got this file for bash completion, I'd like to have something equivalent for Zsh completion. I spent a good amount of time on the bash completion file, and I think it works quite well: it's able to complete with subcommands names, but also with the following parameter names for each subcommands, and with the arguments for some of these parameters. For example, it can suggest actual BPF program IDs or names when relevant.

Eventually, I'd like the Zsh completion to offer the same thing, although it doesn't have to be fully on par from the beginning. I'd recommend getting familiar with bpftool commands' syntax and playing around with the bash completion, to see how it works.

Let me know if you need more specific details.

@varun-r-mallya
Copy link

Yeah, please tell me how exactly I can start contributing and what features you need in this initial version exactly. Like I saw that this is just a mirror and it's actually on the source tree. Haven't really contributed to stuff like this before. Would be grateful for any guides you can send my way.

@qmonnet
Copy link
Member Author

qmonnet commented Feb 16, 2025

I saw that this is just a mirror and it's actually on the source tree.

So even though bpftool and its bash completion are hosted in the kernel repository, I don't expect the Zsh completion to go there, at least not unless we reach feature parity with the bash completion. Several reasons for that:

  • I don't think there's much appetite from kernel folks to get more and more completion files in the kernel repo
  • Bash completion is next to the sources because this allows us to keep it up-to-date when contributors update bpftool. However, this doesn't make sense if the completion is not complete in the first place; and it's also hard enough to have people edit one completion file, I won't start asking contributors to keep two of them updated, especially if one uses a shell variant that most people aren't familiar with.

So we'll keep it in the mirror only I think.

what features you need in this initial version exactly

There's no established minimal feature set. The more, the better, to be honest :). But let's say at the very least, completion for top-level subcommands name must work, and completion for the most basic commands - program, map, link list/dump/edit, for example - should be there, too.

@varun-r-mallya
Copy link

Got that. Starting work on this. This will be a normal GitHub PR in that case, I assume then ?

@qmonnet
Copy link
Member Author

qmonnet commented Feb 16, 2025

Yes please!

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

No branches or pull requests

2 participants