Class: L43Rmap::Cli

Inherits:
Object
  • Object
show all
Includes:
L43::SimpleColor, Color, Help
Defined in:
lib/l43_rmap/cli.rb,
lib/l43_rmap/cli/help.rb,
lib/l43_rmap/cli/color.rb

Defined Under Namespace

Modules: Color, Help

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Help

#help, #help_named, #help_pattern, #help_predefined, #help_sexp

Methods included from Color

#arg, #kwd, #named, #puterr, #puthint, #sexp

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



15
16
17
# File 'lib/l43_rmap/cli.rb', line 15

def args
  @args
end

#kwdsObject (readonly)

Returns the value of attribute kwds.



15
16
17
# File 'lib/l43_rmap/cli.rb', line 15

def kwds
  @kwds
end

#patternObject (readonly)

Returns the value of attribute pattern.



15
16
17
# File 'lib/l43_rmap/cli.rb', line 15

def pattern
  @pattern
end

#runtimeObject (readonly)

Returns the value of attribute runtime.



15
16
17
# File 'lib/l43_rmap/cli.rb', line 15

def runtime
  @runtime
end

Instance Method Details

#run(args) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/l43_rmap/cli.rb', line 17

def run(args)
  parser.parse(args) => :ok, {kwds:, args:}
  @kwds = kwds
  @args = args
  return help if kwds.help
  return help_pattern if kwds.help_pattern
  return help_named if kwds.help_named
  return help_predefined if kwds.help_predefined
  return help_sexp if kwds.help_sexp

  return unless check_args

  return dry_run if kwds.dry_run
  replace_pattern_if_predefined
  return show_parsed if kwds.parse_only

  _compile
  return compiled if kwds.compile_only

  _run
end