Skip to content

Invoke chruby_auto before the prompt prints in interactive mode #191

@postmodern

Description

@postmodern

@zendeavor points out that it is confusing to users that chruby_auto is invoked before the command is executed and before the prompt is printed. If user's (ex: @jc00ke) include $RUBY_ENGINE and $RUBY_VERSION in their $PS1, then these values wont be updated until the command after the cd command is executed. @zendeavor recommends using different hooking strategies for interactive vs. non-interactive modes.

Interactive

  • bash: PROMPT_COMMAND
  • zsh: precmd_functions
  • ksh: PS1

Non-interactive

  • bash: trap DEBUG
  • zsh: preexec_functions
  • ksh: trap DEBUG

This would invoke chruby_auto before PS1 is rendered in interactive mode, but invoke chruby_auto before the command is even executed in non-interactive mode.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions