Class: MagicReveal::Cli::Options

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commandObject

Returns the value of attribute command.



4
5
6
# File 'lib/magic_reveal/cli/options.rb', line 4

def command
  @command
end

Instance Method Details

#parse(args) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/magic_reveal/cli/options.rb', line 13

def parse args
  case args.first
  when 'new'
    if args.length != 2
      @command = :help
    else
      @command = :new
      @project = args[1]
    end
  when 'force-reload'
    @command = :force_reload
  when 'start'
    @command = :start
  when 'static'
    @command = :static
  else # including help
    @command = :help
  end
end

#program_nameObject



9
10
11
# File 'lib/magic_reveal/cli/options.rb', line 9

def program_name
  @program_name ||= File.basename($0)
end