lib/dsu/subcommands/list.rb in dsu-2.1.1 vs lib/dsu/subcommands/list.rb in dsu-2.1.2
- old
+ new
@@ -1,19 +1,19 @@
# frozen_string_literal: true
require_relative '../services/entry_group/counter_service'
require_relative '../support/command_options/dsu_times'
-require_relative '../support/command_options/time_mneumonic'
+require_relative '../support/command_options/time_mnemonic'
require_relative '../support/time_formatable'
require_relative '../views/entry_group/shared/no_entries_to_display'
require_relative '../views/shared/error'
require_relative 'base_subcommand'
module Dsu
module Subcommands
class List < BaseSubcommand
- include Support::CommandOptions::TimeMneumonic
+ include Support::CommandOptions::TimeMnemonic
include Support::TimeFormatable
map %w[d] => :date
map %w[dd] => :dates
map %w[n] => :today
@@ -45,29 +45,29 @@
end
desc I18n.t('subcommands.list.date.desc'), I18n.t('subcommands.list.date.usage')
long_desc I18n.t('subcommands.list.date.long_desc',
date_option_description: date_option_description,
- mneumonic_option_description: mneumonic_option_description)
- def date(date_or_mneumonic)
- time = if time_mneumonic?(date_or_mneumonic)
- time_from_mneumonic(command_option: date_or_mneumonic)
+ mnemonic_option_description: mnemonic_option_description)
+ def date(date_or_mnemonic)
+ time = if time_mnemonic?(date_or_mnemonic)
+ time_from_mnemonic(command_option: date_or_mnemonic)
else
- Time.parse(date_or_mneumonic)
+ Time.parse(date_or_mnemonic)
end
times = sorted_dsu_times_for(times: [time, time.yesterday])
view_list_for(times: times, options: options)
rescue ArgumentError => e
Views::Shared::Error.new(messages: e.message).render
end
desc I18n.t('subcommands.list.dates.desc'), I18n.t('subcommands.list.dates.usage')
long_desc I18n.t('subcommands.list.dates.long_desc',
date_option_description: date_option_description,
- mneumonic_option_description: mneumonic_option_description)
+ mnemonic_option_description: mnemonic_option_description)
option :from, type: :string, required: true, aliases: '-f', banner: 'DATE|MNEMONIC'
option :to, type: :string, required: true, aliases: '-t', banner: 'DATE|MNEMONIC'
- option :include_all, default: false, type: :boolean, aliases: '-a', desc: I18n.t('cli.options.include_all')
+ option :include_all, default: false, type: :boolean, aliases: '-a', desc: I18n.t('options.include_all')
def dates
options = configuration.to_h.merge(self.options).with_indifferent_access
times, errors = Support::CommandOptions::DsuTimes.dsu_times_for(from_option: options[:from], to_option: options[:to]) # rubocop:disable Layout/LineLength
if errors.any?
Views::Shared::Error.new(messages: errors).render