Class: Dsu::Subcommands::Edit
- Inherits:
-
BaseSubcommand
- Object
- Thor
- BaseCLI
- BaseSubcommand
- Dsu::Subcommands::Edit
- Defined in:
- lib/dsu/subcommands/edit.rb
Instance Method Summary collapse
Methods included from Dsu::Support::Ask
Methods inherited from BaseCLI
date_option_description, exit_on_failure?, #initialize, mnemonic_option_description
Methods included from Dsu::Support::TimesSortable
#sorted_dsu_times_for, #times_for, #times_sort
Methods included from Dsu::Support::CommandHookable
Methods included from Dsu::Support::CommandHelpColorizable
Methods included from Dsu::Support::ColorThemable
apply_theme, #prompt_with_options
Constructor Details
This class inherits a constructor from Dsu::BaseCLI
Instance Method Details
#date(date) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/dsu/subcommands/edit.rb', line 18 def date(date) entry_group = Models::EntryGroup.edit(time: Time.parse(date)) Views::EntryGroup::Show.new(entry_group: entry_group).render rescue ArgumentError => e puts apply_theme(I18n.t('errors.error', message: e.), theme_color: color_theme.error) exit 1 end |
#today ⇒ Object
28 29 30 31 |
# File 'lib/dsu/subcommands/edit.rb', line 28 def today entry_group = Models::EntryGroup.edit(time: Time.now) Views::EntryGroup::Show.new(entry_group: entry_group).render end |
#tomorrow ⇒ Object
35 36 37 38 |
# File 'lib/dsu/subcommands/edit.rb', line 35 def tomorrow entry_group = Models::EntryGroup.edit(time: Time.now.tomorrow) Views::EntryGroup::Show.new(entry_group: entry_group).render end |
#yesterday ⇒ Object
42 43 44 45 |
# File 'lib/dsu/subcommands/edit.rb', line 42 def yesterday entry_group = Models::EntryGroup.edit(time: Time.now.yesterday) Views::EntryGroup::Show.new(entry_group: entry_group).render end |