Sha256: 2147a119fcc774c1b070fafb62d4b7b22ff0e8ff78fe87ed7e302e74eb8cc817

Contents?: true

Size: 1.03 KB

Versions: 61

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

# Example command that calls an existing command (tag) with
# preset options
desc 'Add an item to the Later section'
arg_name 'ENTRY'
command :later do |c|
  c.example 'doing later "Something I\'ll think about tomorrow"', desc: 'Add an entry to the Later section'
  c.example 'doing later -e', desc: 'Open $EDITOR to create an entry and optional note'

  c.desc "Edit entry with #{Doing::Util.default_editor}"
  c.switch %i[e editor], negatable: false, default_value: false

  c.desc 'Backdate start time to date string [4pm|20m|2h|yesterday noon]'
  c.arg_name 'DATE_STRING'
  c.flag %i[b back started], type: DateBeginString

  c.desc 'Note'
  c.arg_name 'TEXT'
  c.flag %i[n note]

  c.desc 'Prompt for note via multi-line input'
  c.switch %i[ask], negatable: false, default_value: false

  c.action do |global_options, options, args|
    cmd = commands[:now]
    options[:section] = 'Later'
    options[:finish_last] = false
    action = cmd.send(:get_action, nil)
    action.call(global_options, options, args)
  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
doing-2.1.88 lib/examples/commands/later.rb
doing-2.1.87 lib/examples/commands/later.rb
doing-2.1.86 lib/examples/commands/later.rb
doing-2.1.85 lib/examples/commands/later.rb
doing-2.1.84 lib/examples/commands/later.rb
doing-2.1.83 lib/examples/commands/later.rb
doing-2.1.82 lib/examples/commands/later.rb
doing-2.1.81 lib/examples/commands/later.rb
doing-2.1.80 lib/examples/commands/later.rb
doing-2.1.79 lib/examples/commands/later.rb
doing-2.1.78 lib/examples/commands/later.rb
doing-2.1.77 lib/examples/commands/later.rb
doing-2.1.76 lib/examples/commands/later.rb
doing-2.1.75 lib/examples/commands/later.rb
doing-2.1.74 lib/examples/commands/later.rb
doing-2.1.73 lib/examples/commands/later.rb
doing-2.1.72 lib/examples/commands/later.rb
doing-2.1.69 lib/examples/commands/later.rb
doing-2.1.68 lib/examples/commands/later.rb
doing-2.1.66 lib/examples/commands/later.rb