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

Only run compctl if it's an interactive shell #163

Merged

Conversation

richo
Copy link
Contributor

@richo richo commented Dec 10, 2011

Based on the approach by @imajes

@graywh
Copy link

graywh commented Dec 10, 2011

Perhaps this belongs in rbenv-init instead?

@richo
Copy link
Contributor Author

richo commented Dec 10, 2011

I shouldn't think so.. it is sourced internally by zsh.

Edit: I misrepresented myself. rbenv is responsible for this being sourced, but it's not $SHELL agnostic, and the entirety of the code for zsh completion is contained here. It makes little sense to attempt to move any of it to the core.

@graywh
Copy link

graywh commented Dec 10, 2011

Then perhaps the entire file should be within the if block.

EDIT: Actually, this brings up a good point. I think it would be nice to be able to perform login-only setup separately from interactive-only. For example, when I log in to Gnome, I want rbenv added to my $PATH. When I start a shell, I want the functions and completion. Using 'rbenv init' for the latter duplicates the entries in $PATH.

@richo
Copy link
Contributor Author

richo commented Dec 10, 2011

Valid point.

I am in two minds, it isn't inconcievable that a non interactive process would want to interact with the completion function in some way (automatic and introspective documentation systems perhaps?)

I lean towards agreeing though.

@richo
Copy link
Contributor Author

richo commented Dec 10, 2011

Oh, and relating to your second point, some abuse of $SHLVL may at least let you fix your path.

I will add it to my todo list to create a second init step, or adjust the existing one to test for it's shims in PATH before adding them.

@richo
Copy link
Contributor Author

richo commented Dec 10, 2011

Force pushes don't actually make pull requests as angry as I thought they might.

Huzzah!

@graywh
Copy link

graywh commented Dec 10, 2011

Well Zsh has typeset -U for unique arrays like $path.

@richo
Copy link
Contributor Author

richo commented Dec 10, 2011

I opened an issue for it #164 to avoid clogging this one with unrelated noise when it gets looked over by upstream.

Cheers

sstephenson added a commit that referenced this pull request Dec 24, 2011
…active_shells

Only run compctl if it's an interactive shell
@sstephenson sstephenson merged commit c472116 into rbenv:master Dec 24, 2011
cehoffman pushed a commit to cehoffman/rbenv that referenced this pull request Apr 8, 2014
…interactive_shells

Only run compctl if it's an interactive shell
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.

None yet

3 participants