Sha256: 9680d5ed2693644d24274746ddc0f84a83d68b08c0b054264d0beae38ea07e42
Contents?: true
Size: 708 Bytes
Versions: 1
Compression:
Stored size: 708 Bytes
Contents
require "rbsh" require "optparse" class Rbsh::CLI def initialize(args=[], config={}) @config = config @args, @opts = parse(args) @shell = Rbsh::Shell.new end def self.start(given_args=ARGV, config={}) instance = new(given_args, config) instance.run end def run if @opts.has_key? :v puts Rbsh::VERSION elsif @opts.has_key? :e puts @shell.load_script!(@opts[:e]) else script_file = ARGV[0] end end private def parse(args) opts = {} parser = OptionParser.new parser.on("-e 'command'") { |v| opts[:e] = v } parser.on("-v", "--version") { |v| opts[:v] = v } parser.parse!(args) return args, opts end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rbsh-0.0.1 | lib/rbsh/cli.rb |