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

batman completion #118

Open
christ4k opened this issue May 22, 2024 · 5 comments
Open

batman completion #118

christ4k opened this issue May 22, 2024 · 5 comments
Labels
all Related to all scripts (lib related) documentation Improvements or additions to documentation help wanted Extra attention is needed

Comments

@christ4k
Copy link

When running batman there is no completion upon tab tapping. Is there a way to "link" man autocompletion with batman?

@eth-p
Copy link
Owner

eth-p commented Jun 1, 2024

It would depend on your shell. I'm not sure about completions for bash and zsh, but for fish it is:

complete batman --wraps man

@eth-p eth-p added documentation Improvements or additions to documentation help wanted Extra attention is needed all Related to all scripts (lib related) labels Jun 1, 2024
@christ4k
Copy link
Author

christ4k commented Jun 2, 2024

After a little search, I think I made it out with bash

I found something relative here and here

And I added into .bashrc the following line.

complete -f _longopt batman

I use zsh alongside with bash. I think I did not find the right way to make the same thing on zsh. If someone can tell if the above solution is right, and if someone could tell the "solution" for zsh would be nice!

@minhtrancccp
Copy link

minhtrancccp commented Jul 19, 2024

for those using bash, _comp_cmd_man (the completion function for man included in scop/bash-completion) can be reused for batman:

  • look for the completion script for man, usually /usr/share/bash-completion/completions/man if bash-completion is installed on your system, or download the script from here
  • copy that to a new completion script, preferably named batman, with the complete -F _comp_cmd_man line modified for batman
  • put the new script in ${BASH_COMPLETION_USER_DIR:-$XDG_DATA_HOME/bash-completion}/completions/ for lazy load, or source the script / paste the content of the script to either ~/.bash_completion or ~/.bashrc (see the answer to Where should I install my own local completions?)

@niksingh710
Copy link

@christ4k have you found the way to do it for zsh?

@christ4k
Copy link
Author

christ4k commented Oct 4, 2024

@christ4k have you found the way to do it for zsh?

Not sure if this is again the right way to do it. I followed this and I think I have the basic functionality of autocomplete with batman.

compdef _command batman

I put this line above in my .zshrc file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
all Related to all scripts (lib related) documentation Improvements or additions to documentation help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants