Added fish completions#2203
Closed
LunarEclipse363 wants to merge 1 commit into
Closed
Conversation
Member
|
There's also bash completions already in misc/samtools_tab_completion (which the maintainers might consider renaming to misc/samtools_tab_completion.bash). If installing this fish completion is added to However my suggestion might be to add this fish script to misc/ but continue to not install these completions in |
Contributor
|
Thanks for the completion file, I have merged it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduction
This PR adds comprehensive completions for use with the fish shell.
This includes:
samtoolspython3is available and samtools manpages are installed, generates comprehensive completions with descriptions for the subcommandssamtools help $subcommand(slightly better than the already provided bash completions)I also added an entry in the changelog.
Demonstration of the full capabilities
Notes
I initially tried using the fallback approach as the primary one but after half a day of work realized that the
samtools helpoutputs aren't consistent enough to write a regex to parse them reliably and which could extract all the data (all versions of each flag, what kind of value they take if any, descriptions).Or if it can be done it's so complex I decided it's now worth it.
Doing that somewhat reasonably would require enforcing a strict style guide for help pages like "exactly one space between a flag and its value" and "at least two spaces between the flags/values and descriptions" and I feel like that's not feasible, so I went for extremely limited parsing in this regard and instead used a script bundled with fish to generate high quality completions from manpages (somehow this only worked well for the subcommands, not the main samtools command).
In any case, I'm quite happy with how this turned out and hope that I've fixed all the little bugs in it by now.