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

Refactor completion function #560

Merged
merged 2 commits into from
Jul 18, 2017

Conversation

okdana
Copy link
Contributor

@okdana okdana commented Jul 18, 2017

Hey again! I've been collecting issues left over from my previous effort and i think i've found as many as i can for now.

The biggest problem, which was carried over from the original, was that option completion was basically broken on zsh 5.1 (the latest version available in Ubuntu Xenial). But i also found some typos in option names, missing actions for options that take arguments, missing exclusion rules, &c.

In addition to fixing bugs i improved the colorspec handling slightly, and i added completion for sequences of types when given --type-add <type>:include:. And i re-ordered the options to match the --help output like i mentioned wanting to do before.

I tested this on zsh 5.1, zsh 5.2, and zsh 5.3 and it seems OK. Really hard to test properly though, so i'm sure i'll find something again....

okdana added 2 commits July 18, 2017 04:09
- Improve documentation
- Reorganise into functions
- Order options lexicographically
- Correct minor wording inconsistencies
- Fix --count error
- Fix --maxdepth error
- Fix --path-separator error
- Fix --version error
- Adjust exclusivity for --files, -h, -j, -o, -r, -t, -T, -v, -V, &c.
- Improve pattern-operand guard behaviour
- Partially fix issue with colorspec state
- Fix issue with typespec state
- Add completion for <type>:include: sequence
- Move licence info out of the way
Copy link
Owner

@BurntSushi BurntSushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! As a Bash user, I might start to get jealous. :-)

And yeah, I appreciate that testing this stuff is hard. Fixing things as we go seems like the best course of action.

# Compares options in `rg --help` output to options in zsh completion function
#
# @todo If we could rely on zsh being installed we could change all of this to
# simply source the completion-function file and pull the rg_args array out...
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like you could probably install zsh in the Travis CI config?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, i wasn't sure it was an option. Knowing that it is, i'll probably do that the next time i need to make changes to the function.

@BurntSushi
Copy link
Owner

sigh It looks like Windows CI is failing due to an unrelated test failure. Merging this anyway.

@BurntSushi BurntSushi merged commit 5613df3 into BurntSushi:master Jul 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants