Sha256: a6212f6360b13a6ecfbfaf56daab45f3ca38c943462eff4440c4165c5b07832a

Contents?: true

Size: 507 Bytes

Versions: 6

Compression:

Stored size: 507 Bytes

Contents

class Nib::Shell
  include Nib::Command
  prepend Nib::History

  private

  def entrypoint
    conditions = %i(zsh bash ash).map do |shell|
      "elif hash #{shell} 2>/dev/null ; then #{shell};"
    end

    executable = conditions                            # default conditions
      .unshift('if [ -f bin/shell ]; then bin/shell;') # prepend bin/shell
      .push('else sh; fi')                             # add else clause (`sh`)
      .join("\n")

    "--entrypoint='#{wrap(executable)}'"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nib-2.1.1 lib/nib/shell.rb
nib-2.1.0 lib/nib/shell.rb
nib-2.0.2 lib/nib/shell.rb
nib-2.0.1 lib/nib/shell.rb
nib-2.0.0 lib/nib/shell.rb
nib-1.7.0 lib/nib/shell.rb