Module: Dip::Commands::Console

Defined in:
lib/dip/commands/console.rb

Defined Under Namespace

Classes: Inject, Start

Constant Summary collapse

RESERVED_NAMES =

Interaction command names come straight from dip.yml, and inject turns each one into a same-named shell function. A name that collides with a shell builtin/keyword silently shadows it for the rest of the session — e.g. an interaction called jobs breaks jobs, which things like Starship's prompt call on every render, turning every keystroke into a dip jobs invocation. Skip those instead of aliasing over them.

%w[
  cd pwd test read set jobs type command builtin history alias unalias
  source eval exec exit return break continue trap kill wait bg fg
  export unset declare typeset readonly local shift times true false
  echo printf time status functions function end
].freeze

Class Method Summary collapse

Class Method Details

.detect_shell(explicit = nil) ⇒ Object

Figure out which shell dialect to generate integration code for.

An explicit value (from --shell) always wins. Otherwise we guess from the $SHELL environment variable and fall back to the POSIX flavour (bash/zsh) which was the only supported one historically.



27
28
29
30
# File 'lib/dip/commands/console.rb', line 27

def self.detect_shell(explicit = nil)
  name = (explicit || File.basename(ENV["SHELL"].to_s)).to_s.downcase
  name.include?("fish") ? :fish : :posix
end