Class: WorkLogCli
- Inherits:
-
Thor
- Object
- Thor
- WorkLogCli
- Defined in:
- lib/work_log_cli.rb
Instance Method Summary collapse
Instance Method Details
#__print_version ⇒ Object
73 74 75 76 |
# File 'lib/work_log_cli.rb', line 73 def __print_version spec = Gem::Specification.load('myworklog.gemspec') puts spec.version end |
#add(description) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/work_log_cli.rb', line 17 def add(description) date = [:d] || 'today' WorkLogController.new.add_work_log(date, description) rescue ArgumentError => e puts e end |
#delete(id) ⇒ Object
64 65 66 67 68 69 |
# File 'lib/work_log_cli.rb', line 64 def delete(id) WorkLogController.new.delete(id) puts "Work log with #{id} ID has been deleted!" rescue ArgumentError => e puts e end |
#list(date = '') ⇒ Object
56 57 58 59 60 |
# File 'lib/work_log_cli.rb', line 56 def list(date = '') return print(WorkLogController.new.list_all) if [:all] print(ListStrategy.new(date, [:m], [:y]).execute) end |