Skip to content

Commit

Permalink
Add todo to example plugins
Browse files Browse the repository at this point in the history
- NEW: Add todo as an example command plugin
  • Loading branch information
ttscoff committed Mar 26, 2024
1 parent 330d6ab commit 8db140b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
### 2.1.85

2024-03-26 10:02

#### FIXED

- Error thrown when trying to guess a section/view when there's no match.

### 2.1.84

2023-08-17 09:49
Expand Down
29 changes: 29 additions & 0 deletions lib/examples/commands/todo.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

# @@todo
desc 'Add an item as a Todo'
long_desc 'Adds an item to a Todo section, and tags it with @todo'
arg_name 'ENTRY'
command :todo do |c|
c.example 'doing todo "Something I\'ll think about tomorrow"', desc: 'Add an entry to the Todo section with tag @todo'
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 '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] = 'Todo'
options[:finish_last] = false
action = cmd.send(:get_action, nil)
string = args.join(' ').add_tags('todo')
action.call(global_options, options, [string])
end
end

0 comments on commit 8db140b

Please sign in to comment.