Module: Console::Mux

Includes:
Log4r
Defined in:
lib/console/mux.rb,
lib/console/mux/util.rb,
lib/console/mux/shell.rb,
lib/console/mux/events.rb,
lib/console/mux/command.rb,
lib/console/mux/console.rb,
lib/console/mux/process.rb,
lib/console/mux/run_with.rb,
lib/console/mux/command_set.rb,
lib/console/mux/pty_handler.rb,
lib/console/mux/rolling_array.rb,
lib/console/mux/color_formatter.rb,
lib/console/mux/buffer_outputter.rb,
lib/console/mux/console_outputter.rb

Defined Under Namespace

Modules: Events, PTYHandler, Util Classes: BufferOutputter, ColorFormatter, Command, CommandSet, Console, ConsoleOutputter, Process, RollingArray, RunWith, Shell

Constant Summary collapse

VERSION =
File.read(File.expand_path('../../../VERSION', __FILE__), 16).strip
BUNDLE_EXEC_SH =
File.expand_path('bundle_exec.sh',
File.join(__FILE__, '..', 'mux'))

Class Method Summary collapse

Class Method Details

.run(options) ⇒ Object



73
74
75
# File 'lib/console/mux.rb', line 73

def self.run(options)
  Console.new(options).startup
end

.run_argv(args = ARGV) ⇒ Object

Parameters:

  • args (Array) (defaults to: ARGV)

    commandline arguments



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/console/mux.rb', line 37

def self.run_argv(args = ARGV)
  options = {
    :init_file => nil
  }

  oparser = OptionParser.new do |opts|
    opts.banner = "Usage: console-mux <init_file>"
    opts.on_tail('-h', '--help', 'Show this message') do
      puts opts
      exit
    end
    opts.on('-f', '--init=FILE', 'Load this init file') do |file|
      options[:init_file] = file
    end
    opts.on('--version', 'Print the version and exit') do
      puts VERSION
      exit
    end
  end
  oparser.parse!(args)

  options[:init_file] ||= args.shift
  unless options[:init_file]
    $stderr.puts oparser
    exit 1
  end

  begin
    run(options)
  rescue Errno::ENOENT => e
    $stderr.puts e.message
    $stderr.puts e.backtrace.join("\n    ")
    exit 1
  end
end