Sha256: 130ae1771c3ec5934fc5158e98b3b82c8a87422eef612a7ee1d271ea2d199d94

Contents?: true

Size: 1.53 KB

Versions: 30

Compression:

Stored size: 1.53 KB

Contents

# @@today
desc 'List entries from today'
long_desc 'List entries from the current day. Use --before, --after, and
--from to specify time ranges.'
command :today do |c|
  c.example 'doing today', desc: 'List all entries with start dates between 12am and 11:59PM for the current day'
  c.example 'doing today --section Later', desc: 'List today\'s entries in the Later section'
  c.example 'doing today --before 3pm --after 12pm', desc: 'List entries with start dates between 12pm and 3pm today'
  c.example 'doing today --output json', desc: 'Output entries from today in JSON format'

  c.desc 'Specify a section'
  c.arg_name 'NAME'
  c.flag %i[s section], default_value: 'All'

  add_options(:output_template, c, default_template: 'today')
  add_options(:time_filter, c)
  add_options(:time_display, c)
  add_options(:save, c)

  c.action do |_global_options, options, _args|
    raise InvalidPlugin.new('output', options[:output]) if options[:output] && options[:output] !~ Doing::Plugins.plugin_regex(type: :export)

    options[:times] = true if options[:totals]
    options[:sort_tags] = options[:tag_sort]
    filter_options = %i[after before times duration from section sort_tags totals tag_order template config_template only_timed].each_with_object({}) { |k, hsh| hsh[k] = options[k] }
    filter_options[:today] = true
    Doing::Pager.page @wwid.today(options[:times], options[:output], filter_options).chomp
    filter_options[:title] = options[:title]
    Doing.config.save_view(filter_options.to_view, options[:save].downcase) if options[:save]
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
doing-2.1.80 bin/commands/today.rb
doing-2.1.79 bin/commands/today.rb
doing-2.1.78 bin/commands/today.rb
doing-2.1.77 bin/commands/today.rb
doing-2.1.76 bin/commands/today.rb
doing-2.1.75 bin/commands/today.rb
doing-2.1.74 bin/commands/today.rb
doing-2.1.73 bin/commands/today.rb
doing-2.1.72 bin/commands/today.rb
doing-2.1.69 bin/commands/today.rb
doing-2.1.68 bin/commands/today.rb
doing-2.1.66 bin/commands/today.rb
doing-2.1.65 bin/commands/today.rb
doing-2.1.64 bin/commands/today.rb
doing-2.1.63 bin/commands/today.rb
doing-2.1.62 bin/commands/today.rb
doing-2.1.61 bin/commands/today.rb
doing-2.1.60 bin/commands/today.rb
doing-2.1.58 bin/commands/today.rb
doing-2.1.57 bin/commands/today.rb