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.41 lib/examples/commands/later.rb
doing-2.1.40 lib/examples/commands/later.rb
doing-2.1.39 lib/examples/commands/later.rb
doing-2.1.38 lib/examples/commands/later.rb
doing-2.1.37 lib/examples/commands/later.rb
doing-2.1.36 lib/examples/commands/later.rb
doing-2.1.35 lib/examples/commands/later.rb
doing-2.1.34 lib/examples/commands/later.rb
doing-2.1.33 lib/examples/commands/later.rb
doing-2.1.32 lib/examples/commands/later.rb
doing-2.1.31pre lib/examples/commands/later.rb
doing-2.1.30 lib/examples/commands/later.rb
doing-2.1.29 lib/examples/commands/later.rb
doing-2.1.28 lib/examples/commands/later.rb
doing-2.1.27 lib/examples/commands/later.rb
doing-2.1.26 lib/examples/commands/later.rb
doing-2.1.25 lib/examples/commands/later.rb
doing-2.1.24 lib/examples/commands/later.rb
doing-2.1.23 lib/examples/commands/later.rb
doing-2.1.22 lib/examples/commands/later.rb