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

fix colon in bash completion #4

Merged
merged 4 commits into from
Jan 5, 2013
Merged

fix colon in bash completion #4

merged 4 commits into from
Jan 5, 2013

Conversation

godlikejay
Copy link
Contributor

If bash-completion takes colon as a word breaker, ${COMP_WORDS[COMP_CWORD]} will not get the complete nose search path.

This pull request detects if colon is used for a breaker, and adds the previous word into the final parameter to nosecomplete.

@alonho
Copy link
Owner

alonho commented Jan 5, 2013

that's what __ltrim_colon_completions is trying to solve. can you show me an example where it doesn't work?

@godlikejay
Copy link
Contributor Author

@alonho __ltrim_colon_completions will only trim the leading filename before the colon, it is used to filter the COMPREPLY. But my patch is to make nosecomplete get the full search path.

For example, when try to complete the following cmd:

nosetests test_file.py:test_<TAB>

On my ubuntu, bash 4.2, with $COMP_WORDBREAKS including :, the COMP_WORDS is ( 'nosetests' 'test_file.py' ':' 'test_' ), so that ${COMP_WORDS[COMP_CWORD]} will only get test_, which is different from the expected test_file.py:test_ for nosecomplete.

My patch will try to join COMP_WORDS broken by : back, in the above case, $cur would be corrected to test_file.py:test_.

And one more thing about __ltrim_colon_completions, suppose COMREPLY as ( 'test_file.py:test_1' 'test_file.py:test_2' ), after __ltrim_colon_completions is executed, COMREPLY will be updated as ( 'test_1' 'test_2' ) for further completion.

alonho added a commit that referenced this pull request Jan 5, 2013
fix colon in bash completion
@alonho alonho merged commit 94b8f2a into alonho:master Jan 5, 2013
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