-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Fall back to _filedir, compgen -f, etc. if no matches are returned #4
Comments
+1 |
@beaugunderson Is there a way I can use your solution in my own omelette integration? |
@wcandillon yeah, just modify the completion function after omelette generates it; here's the diff of mine: --- projects-unmodified.sh 2015-03-17 18:23:39.000000000 -0700
+++ projects-modified.sh 2014-12-13 14:00:02.000000000 -0800
@@ -6,8 +6,39 @@
compdef _projects_complette projects
elif type complete &>/dev/null; then
_projects_complette() {
- COMPREPLY=( $(compgen -W '$(projects --compbash --compgen "${COMP_CWORD}" "${COMP_WORDS[COMP_CWORD-1]}" "${COMP_LINE}")' -- "${COMP_WORDS[COMP_CWORD]}") )
+ local cur prev
+
+ cur=${COMP_WORDS[COMP_CWORD]}
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ COMPREPLY=( $(compgen -W '$(projects --compbash --compgen "${COMP_CWORD}" "${prev}" "${COMP_LINE}")' -- "$cur") )
+
+ [[ $COMPREPLY ]] && return
+
+ _filedir
}
complete -F _projects_complette projects
fi
### projects completion - end ###
|
The changes I made were:
|
@beaugunderson thks a lot! |
@beaugunderson On the fallback I'm getting: |
@wcandillon What operating system? On OS X you can On Ubuntu you can You could also try replacing the line compopt -o filenames
compgen -f But I think |
Programs that use omelette completion can no longer complete files and directories. I modified my completion script to fall back to
_filedir
(it relies on the$cur
and$prev
variables):In the same way
compgen -f
withcompopt -o filenames
could be used, I think.The text was updated successfully, but these errors were encountered: