Module: David

Defined in:
lib/david.rb,
lib/david/command.rb,
lib/david/version.rb,
lib/david/configure.rb

Defined Under Namespace

Classes: Command, Configure, Error

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.get_command(conf, args) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/david.rb', line 23

def self.get_command(conf, args)
  if args.size == 1
    if args[0].start_with? '-'
      return nil
    else
      return Command.new(conf, nil).parse_args(args)
    end
  elsif args.size > 1
    return Command.new(conf, nil).parse_args(args)
  else
    return nil
  end
end

.mainObject

Your code goes here…



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/david.rb', line 9

def self.main
  puts ARGV
  args = ARGV

  conf = Configure.new
  cmd = self.get_command(conf, args)

  if cmd.nil?
    Command.interact(conf)
  else
    cmd.execute
  end
end