Class: Rem2ics::CLI
- Inherits:
-
Object
- Object
- Rem2ics::CLI
- Defined in:
- lib/rem2ics/cli.rb
Overview
The rem2ics command.
Streams are injected rather than assumed, so the whole command is testable
without shelling out or capturing $stdout.
Defined Under Namespace
Classes: Options
Constant Summary collapse
- EXIT_SUCCESS =
0- EXIT_FAILURE =
1- EXIT_USAGE =
2- STDIN =
Remind reads standard input under this name; so does this.
"-"
Instance Attribute Summary collapse
-
#err ⇒ Object
readonly
Returns the value of attribute err.
-
#out ⇒ Object
readonly
Returns the value of attribute out.
Instance Method Summary collapse
- #call(argv) ⇒ Object
-
#initialize(out: $stdout, err: $stderr) ⇒ CLI
constructor
A new instance of CLI.
Constructor Details
#initialize(out: $stdout, err: $stderr) ⇒ CLI
Returns a new instance of CLI.
33 34 35 36 |
# File 'lib/rem2ics/cli.rb', line 33 def initialize(out: $stdout, err: $stderr) @out = out @err = err end |
Instance Attribute Details
#err ⇒ Object (readonly)
Returns the value of attribute err.
31 32 33 |
# File 'lib/rem2ics/cli.rb', line 31 def err @err end |
#out ⇒ Object (readonly)
Returns the value of attribute out.
31 32 33 |
# File 'lib/rem2ics/cli.rb', line 31 def out @out end |
Instance Method Details
#call(argv) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rem2ics/cli.rb', line 38 def call(argv) = Options.new( paths: [], today: Date.today, horizon: Recurrence::DEFAULT_HORIZON, organizer: nil, ) dispatch(parse(argv, ), ) rescue OptionParser::ParseError, Date::Error => error err.puts(error.) EXIT_USAGE end |