Add bash completion by scop · Pull Request #1678 · sharkdp/bat (original) (raw)

@sharkdp I'm not too familiar with Bash completions, but I'll give it a look. I'll need to give it a proper review later, but this seems good from a quick glance.

This implementation is self contained and does not require https://github.com/scop/bash-completion. If a dependency on it would be ok, adding it would make it possible to clean this up some, and would gain easy support for completing long options separated by = (which this one doesn't currently, and I'd rather not duplicate the code for that). Let me know if that would be desirable and I can adjust this.

I would actually say this is one of those cases where it's fine to add an external dependency. From my understanding, a ton of other programs use bash-completion for their completions as well, and there's probably a good chance it will be installed already.

In the cases where it isn't (e.g. Mac), it shouldn't be too hard for package managers to simply add a dependency.

@Shark, thoughts?