Class: Rbsh::CLI
- Inherits:
-
Object
- Object
- Rbsh::CLI
- Defined in:
- lib/rbsh/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args = [], config = {}) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
Class Method Details
.start(given_args = ARGV, config = {}) ⇒ Object
12 13 14 15 |
# File 'lib/rbsh/cli.rb', line 12 def self.start(given_args=ARGV, config={}) instance = new(given_args, config) instance.run end |
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rbsh/cli.rb', line 17 def run if @opts.has_key? :v puts Rbsh::VERSION elsif @opts.has_key? :e puts @shell.load_script!(@opts[:e]).run!.to_s else script_file = ARGV[0] script = File.open(script_file).read puts @shell.load_script!(script).run!.to_s end end |