Class: Manlycraft::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/manlycraft/cli.rb

Class Method Summary collapse

Class Method Details

.start(*args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/manlycraft/cli.rb', line 5

def self.start(*args)
  begin
    if $stdin.isatty
      $stdin.sync = true
    end
    if $stdout.isatty
      $stdout.sync = true
    end

    command = args.shift.strip rescue "help"

    Manlycraft::Command.load
    Manlycraft::Command.run(command, args)
  rescue Interrupt
    `stty icanon echo`
    error("Command cancelled.")
  #rescue => error
    #puts error
    #exit(1)
  end
end