Class: L43::Time::TimeCalc::Cli

Inherits:
Object
  • Object
show all
Includes:
Color::Output, FormatTime, Calculate
Defined in:
lib/l43/time/time_calc/cli.rb,
lib/l43/time/time_calc/cli/help.rb,
lib/l43/time/time_calc/cli/arguments.rb

Defined Under Namespace

Modules: Arguments, Help

Constant Summary

Constants included from FormatTime

FormatTime::LegalFormats

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FormatTime

#format_time, #format_time!

Methods included from L43::Time::Tools::MapOk

#map_ok

Instance Attribute Details

#arg_parser ⇒ Object (readonly)

Returns the value of attribute arg_parser.



21
22
23
# File 'lib/l43/time/time_calc/cli.rb', line 21

def arg_parser
  @arg_parser
end

#args ⇒ Object (readonly)

Returns the value of attribute args.



21
22
23
# File 'lib/l43/time/time_calc/cli.rb', line 21

def args
  @args
end

#format ⇒ Object (readonly)

Returns the value of attribute format.



21
22
23
# File 'lib/l43/time/time_calc/cli.rb', line 21

def format
  @format
end

#kwds ⇒ Object (readonly)

Returns the value of attribute kwds.



21
22
23
# File 'lib/l43/time/time_calc/cli.rb', line 21

def kwds
  @kwds
end

Instance Method Details

#run(argv) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/l43/time/time_calc/cli.rb', line 25

def run(argv)
  result = arg_parser.parse(argv)
  case result
  in true, args, [], kwds
    @args = args
    @kwds = kwds
    _run
  in false, _, errors, _
    errors.each do |error|
      putcol(error, to: $stderr)
    end
  end
end