Module: FMS::CmdLine

Defined in:
lib/fms/cmdline.rb

Defined Under Namespace

Modules: MethodCaller, MethodParser, Output, ParamsParser

Class Method Summary collapse

Class Method Details

.call_if_possible(method, params) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/fms/cmdline.rb', line 15

def call_if_possible(method, params)
  return Output.help_message if help_method? method

  if method and params
    call_method method, params
  else
    Output.invalid_command
    Output.help_message
  end
end

.call_method(method, params) ⇒ Object



26
27
28
# File 'lib/fms/cmdline.rb', line 26

def call_method(method, params)
  MethodCaller.call method, params
end

.help_method?(method) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/fms/cmdline.rb', line 30

def help_method?(method)
  method == "help"
end

.parse(argv) ⇒ Object



8
9
10
11
12
13
# File 'lib/fms/cmdline.rb', line 8

def parse(argv)
  method = MethodParser.parse(argv)
  params = ParamsParser.parse(argv)
  call_if_possible method, params
  Output.flush
end