Class: MagicReveal::Cli::Options

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

Overview

Command line options

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commandObject

Returns the value of attribute command.



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

def command
  @command
end

#projectObject

Returns the value of attribute project.



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

def project
  @project
end

Instance Method Details

#parse(args) ⇒ Object

rubocop:disable MethodLength



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

def parse(args) # rubocop:disable MethodLength
  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



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

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