na 1.2.45 → 1.2.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +1 -1
- data/README.md +46 -42
- data/bin/commands/archive.rb +11 -2
- data/bin/commands/complete.rb +7 -2
- data/bin/commands/update.rb +13 -7
- data/lib/na/action.rb +2 -1
- data/lib/na/next_action.rb +24 -22
- data/lib/na/todo.rb +1 -3
- data/lib/na/version.rb +1 -1
- data/src/_README.md +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '0847ca8c8b5746d6e0f099c5bfc38d00dd01353acc7bceda6c5c6423ed16630f'
|
|
4
|
+
data.tar.gz: 6e7eecaf402a4268826095e6b46b4f1fad26a7e454b6162a6ef113f04e91a660
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 794d54bd290f665f51bb1d74846c83a4406ba76568132591ab19fe146bbbbce844be4e6fff2be05c73170f3666a87edc5446bf1380d1a7c8ded9848fbba9c4a9
|
|
7
|
+
data.tar.gz: de1cea81c7612bf8beaa0b73243aa687e9325d46e0c93d139cda87d6792fb99a2614812671b68f6ae9961adde9040c669ce73c5ae1f39d1215820187345ca21b
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
_If you're one of the rare people like me who find this useful, feel free to
|
|
10
10
|
[buy me some coffee][donate]._
|
|
11
11
|
|
|
12
|
-
The current version of `na` is 1.2.
|
|
12
|
+
The current version of `na` is 1.2.46
|
|
13
13
|
.
|
|
14
14
|
|
|
15
15
|
`na` ("next action") is a command line tool designed to make it easy to see what your next actions are for any project, right from the command line. It works with TaskPaper-formatted files (but any plain text format will do), looking for `@na` tags (or whatever you specify) in todo files in your current folder.
|
|
@@ -77,7 +77,7 @@ SYNOPSIS
|
|
|
77
77
|
na [global options] command [command options] [arguments...]
|
|
78
78
|
|
|
79
79
|
VERSION
|
|
80
|
-
1.2.
|
|
80
|
+
1.2.46
|
|
81
81
|
|
|
82
82
|
GLOBAL OPTIONS
|
|
83
83
|
-a, --add - Add a next action (deprecated, for backwards compatibility)
|
|
@@ -487,26 +487,27 @@ DESCRIPTION
|
|
|
487
487
|
Provides an easy way to complete, prioritize, and tag existing actions. If multiple todo files are found in the current directory, a menu will allow you to pick which file to act on.
|
|
488
488
|
|
|
489
489
|
COMMAND OPTIONS
|
|
490
|
-
-a, --archive
|
|
491
|
-
--all
|
|
492
|
-
--at=POSITION
|
|
493
|
-
-d, --depth=DEPTH
|
|
494
|
-
--delete
|
|
495
|
-
--[no-]done
|
|
496
|
-
-e, --regex
|
|
497
|
-
--edit
|
|
498
|
-
-f, --finish
|
|
499
|
-
--file=PATH
|
|
500
|
-
--in, --todo=TODO_FILE
|
|
501
|
-
-n, --note
|
|
502
|
-
-o, --overwrite
|
|
503
|
-
-p, --priority=PRIO
|
|
504
|
-
|
|
505
|
-
--
|
|
506
|
-
|
|
507
|
-
--
|
|
508
|
-
--
|
|
509
|
-
|
|
490
|
+
-a, --archive - Add a @done tag to action and move to Archive
|
|
491
|
+
--all - Act on all matches immediately (no menu)
|
|
492
|
+
--at=POSITION - When moving task, add at [s]tart or [e]nd of target project (default: none)
|
|
493
|
+
-d, --depth=DEPTH - Search for files X directories deep (default: 1)
|
|
494
|
+
--delete - Delete an action
|
|
495
|
+
--[no-]done - Include @done actions
|
|
496
|
+
-e, --regex - Interpret search pattern as regular expression
|
|
497
|
+
--edit - Open action in editor (vim). Natural language dates will be parsed and converted in date-based tags.
|
|
498
|
+
-f, --finish - Add a @done tag to action
|
|
499
|
+
--file=PATH - Specify the file to search for the task (default: none)
|
|
500
|
+
--in, --todo=TODO_FILE - Use a known todo file, partial matches allowed (default: none)
|
|
501
|
+
-n, --note - Prompt for additional notes. Input will be appended to any existing note. If STDIN input (piped) is detected, it will be used as a note.
|
|
502
|
+
-o, --overwrite - Overwrite note instead of appending
|
|
503
|
+
-p, --priority=PRIO - Add/change a priority level 1-5 (default: 0)
|
|
504
|
+
--proj, --project=PROJECT[/SUBPROJECT] - Affect actions from a specific project (default: none)
|
|
505
|
+
-r, --remove=TAG - Remove a tag from the action, use multiple times or combine multiple tags with a comma, wildcards (* and ?) allowed (may be used more than once, default: none)
|
|
506
|
+
--restore - Remove @done tag from action
|
|
507
|
+
-t, --tag=TAG - Add a tag to the action, @tag(values) allowed, use multiple times or combine multiple tags with a comma (may be used more than once, default: none)
|
|
508
|
+
--tagged=TAG - Match actions containing tag. Allows value comparisons (may be used more than once, default: none)
|
|
509
|
+
--to, --move=PROJECT - Move action to specific project (default: none)
|
|
510
|
+
-x, --exact - Match pattern exactly
|
|
510
511
|
|
|
511
512
|
EXAMPLES
|
|
512
513
|
|
|
@@ -546,17 +547,18 @@ SYNOPSIS
|
|
|
546
547
|
na [global options] complete [command options] ACTION
|
|
547
548
|
|
|
548
549
|
COMMAND OPTIONS
|
|
549
|
-
-a, --archive
|
|
550
|
-
--all
|
|
551
|
-
-d, --depth=DEPTH
|
|
552
|
-
-e, --regex
|
|
553
|
-
--file=PATH
|
|
554
|
-
--in, --todo=TODO_FILE
|
|
555
|
-
-n, --note
|
|
556
|
-
-o, --overwrite
|
|
557
|
-
--
|
|
558
|
-
--
|
|
559
|
-
|
|
550
|
+
-a, --archive - Add a @done tag to action and move to Archive
|
|
551
|
+
--all - Act on all matches immediately (no menu)
|
|
552
|
+
-d, --depth=DEPTH - Search for files X directories deep (default: 1)
|
|
553
|
+
-e, --regex - Interpret search pattern as regular expression
|
|
554
|
+
--file=PATH - Specify the file to search for the task (default: none)
|
|
555
|
+
--in, --todo=TODO_FILE - Use a known todo file, partial matches allowed (default: none)
|
|
556
|
+
-n, --note - Prompt for additional notes. Input will be appended to any existing note. If STDIN input (piped) is detected, it will be used as a note.
|
|
557
|
+
-o, --overwrite - Overwrite note instead of appending
|
|
558
|
+
--proj, --project=PROJECT[/SUBPROJECT] - Affect actions from a specific project (default: none)
|
|
559
|
+
--tagged=TAG - Match actions containing tag. Allows value comparisons (may be used more than once, default: none)
|
|
560
|
+
--to, --move=PROJECT - Move action to specific project (default: none)
|
|
561
|
+
-x, --exact - Match pattern exactly
|
|
560
562
|
|
|
561
563
|
EXAMPLES
|
|
562
564
|
|
|
@@ -580,15 +582,17 @@ SYNOPSIS
|
|
|
580
582
|
na [global options] archive [command options] ACTION
|
|
581
583
|
|
|
582
584
|
COMMAND OPTIONS
|
|
583
|
-
--all
|
|
584
|
-
-d, --depth=DEPTH
|
|
585
|
-
--done
|
|
586
|
-
-e, --regex
|
|
587
|
-
--file=PATH
|
|
588
|
-
|
|
589
|
-
-
|
|
590
|
-
--
|
|
591
|
-
|
|
585
|
+
--all - Act on all matches immediately (no menu)
|
|
586
|
+
-d, --depth=DEPTH - Search for files X directories deep (default: 1)
|
|
587
|
+
--done - Archive all done tasks
|
|
588
|
+
-e, --regex - Interpret search pattern as regular expression
|
|
589
|
+
--file=PATH - Specify the file to search for the task (default: none)
|
|
590
|
+
--in, --todo=TODO_FILE - Use a known todo file, partial matches allowed (default: none)
|
|
591
|
+
-n, --note - Prompt for additional notes. Input will be appended to any existing note. If STDIN input (piped) is detected, it will be used as a note.
|
|
592
|
+
-o, --overwrite - Overwrite note instead of appending
|
|
593
|
+
--proj, --project=PROJECT[/SUBPROJECT] - Affect actions from a specific project (default: none)
|
|
594
|
+
--tagged=TAG - Match actions containing tag. Allows value comparisons (may be used more than once, default: none)
|
|
595
|
+
-x, --exact - Match pattern exactly
|
|
592
596
|
|
|
593
597
|
EXAMPLE
|
|
594
598
|
|
data/bin/commands/archive.rb
CHANGED
|
@@ -30,6 +30,10 @@ class App
|
|
|
30
30
|
c.arg_name 'TAG'
|
|
31
31
|
c.flag %i[tagged], multiple: true
|
|
32
32
|
|
|
33
|
+
c.desc 'Affect actions from a specific project'
|
|
34
|
+
c.arg_name 'PROJECT[/SUBPROJECT]'
|
|
35
|
+
c.flag %i[proj project]
|
|
36
|
+
|
|
33
37
|
c.desc 'Act on all matches immediately (no menu)'
|
|
34
38
|
c.switch %i[all], negatable: false
|
|
35
39
|
|
|
@@ -39,15 +43,20 @@ class App
|
|
|
39
43
|
c.desc 'Match pattern exactly'
|
|
40
44
|
c.switch %i[x exact], negatable: false
|
|
41
45
|
|
|
46
|
+
c.desc 'Use a known todo file, partial matches allowed'
|
|
47
|
+
c.arg_name 'TODO_FILE'
|
|
48
|
+
c.flag %i[in todo]
|
|
49
|
+
|
|
42
50
|
c.action do |global, options, args|
|
|
43
51
|
if options[:done]
|
|
44
|
-
options[:tagged]
|
|
52
|
+
options[:tagged] << 'done'
|
|
45
53
|
options[:all] = true
|
|
46
54
|
end
|
|
47
55
|
|
|
48
56
|
options[:done] = true
|
|
57
|
+
options['done'] = true
|
|
49
58
|
options[:finish] = true
|
|
50
|
-
options[:
|
|
59
|
+
options[:move] = 'Archive'
|
|
51
60
|
options[:archive] = true
|
|
52
61
|
options[:a] = true
|
|
53
62
|
|
data/bin/commands/complete.rb
CHANGED
|
@@ -22,7 +22,11 @@ class App
|
|
|
22
22
|
|
|
23
23
|
c.desc 'Move action to specific project'
|
|
24
24
|
c.arg_name 'PROJECT'
|
|
25
|
-
c.flag %i[to
|
|
25
|
+
c.flag %i[to move]
|
|
26
|
+
|
|
27
|
+
c.desc 'Affect actions from a specific project'
|
|
28
|
+
c.arg_name 'PROJECT[/SUBPROJECT]'
|
|
29
|
+
c.flag %i[proj project]
|
|
26
30
|
|
|
27
31
|
c.desc 'Specify the file to search for the task'
|
|
28
32
|
c.arg_name 'PATH'
|
|
@@ -52,7 +56,8 @@ class App
|
|
|
52
56
|
c.action do |global, options, args|
|
|
53
57
|
options[:finish] = true
|
|
54
58
|
options[:f] = true
|
|
55
|
-
options[:
|
|
59
|
+
options[:to] = 'Archive' if options[:archive] && !options[:to]
|
|
60
|
+
options[:move] = 'Archive' if options[:archive] && !options[:move]
|
|
56
61
|
|
|
57
62
|
cmd = commands[:update]
|
|
58
63
|
action = cmd.send(:get_action, nil)
|
data/bin/commands/update.rb
CHANGED
|
@@ -33,7 +33,11 @@ class App
|
|
|
33
33
|
|
|
34
34
|
c.desc 'Move action to specific project'
|
|
35
35
|
c.arg_name 'PROJECT'
|
|
36
|
-
c.flag %i[to
|
|
36
|
+
c.flag %i[to move]
|
|
37
|
+
|
|
38
|
+
c.desc 'Affect actions from a specific project'
|
|
39
|
+
c.arg_name 'PROJECT[/SUBPROJECT]'
|
|
40
|
+
c.flag %i[proj project]
|
|
37
41
|
|
|
38
42
|
c.desc 'Use a known todo file, partial matches allowed'
|
|
39
43
|
c.arg_name 'TODO_FILE'
|
|
@@ -90,6 +94,7 @@ class App
|
|
|
90
94
|
|
|
91
95
|
c.action do |global_options, options, args|
|
|
92
96
|
reader = TTY::Reader.new
|
|
97
|
+
|
|
93
98
|
append = options[:at] ? options[:at] =~ /^[ae]/i : global_options[:add_at] =~ /^[ae]/i
|
|
94
99
|
|
|
95
100
|
if options[:restore] || (!options[:remove].nil? && options[:remove].include?('done'))
|
|
@@ -97,7 +102,7 @@ class App
|
|
|
97
102
|
options[:tagged] << '+done'
|
|
98
103
|
elsif !options[:remove].nil? && !options[:remove].empty?
|
|
99
104
|
options[:tagged].concat(options[:remove])
|
|
100
|
-
elsif options[:finish]
|
|
105
|
+
elsif options[:finish] && !options[:done]
|
|
101
106
|
options[:tagged] << '-done'
|
|
102
107
|
end
|
|
103
108
|
|
|
@@ -168,8 +173,8 @@ class App
|
|
|
168
173
|
note = stdin_note.empty? ? [] : stdin_note
|
|
169
174
|
note.concat(line_note) unless line_note.nil? || line_note.empty?
|
|
170
175
|
|
|
171
|
-
target_proj = if options[:
|
|
172
|
-
options[:
|
|
176
|
+
target_proj = if options[:move]
|
|
177
|
+
options[:move]
|
|
173
178
|
elsif NA.cwd_is == :project
|
|
174
179
|
NA.cwd
|
|
175
180
|
end
|
|
@@ -204,7 +209,7 @@ class App
|
|
|
204
209
|
files = NA.find_files_matching({
|
|
205
210
|
depth: options[:depth],
|
|
206
211
|
done: options[:done],
|
|
207
|
-
project:
|
|
212
|
+
project: options[:project],
|
|
208
213
|
regex: options[:regex],
|
|
209
214
|
require_na: false,
|
|
210
215
|
search: tokens,
|
|
@@ -219,7 +224,7 @@ class App
|
|
|
219
224
|
|
|
220
225
|
if options[:archive]
|
|
221
226
|
options[:finish] = true
|
|
222
|
-
options[:
|
|
227
|
+
options[:move] = 'Archive'
|
|
223
228
|
end
|
|
224
229
|
|
|
225
230
|
NA.notify("#{NA.theme[:error]}No search terms provided", exit_code: 1) if tokens.nil? && options[:tagged].empty?
|
|
@@ -233,10 +238,11 @@ class App
|
|
|
233
238
|
done: options[:done],
|
|
234
239
|
edit: options[:edit],
|
|
235
240
|
finish: options[:finish],
|
|
241
|
+
move: target_proj,
|
|
236
242
|
note: note,
|
|
237
243
|
overwrite: options[:overwrite],
|
|
238
244
|
priority: priority,
|
|
239
|
-
project:
|
|
245
|
+
project: options[:project],
|
|
240
246
|
remove_tag: remove_tags,
|
|
241
247
|
tagged: tags)
|
|
242
248
|
end
|
data/lib/na/action.rb
CHANGED
|
@@ -59,6 +59,7 @@ module NA
|
|
|
59
59
|
@project: #{@project}
|
|
60
60
|
@parent: #{@parent.join('>')}
|
|
61
61
|
@action: #{@action}
|
|
62
|
+
@tags: #{@tags}
|
|
62
63
|
@note: #{@note}
|
|
63
64
|
EOINSPECT
|
|
64
65
|
end
|
|
@@ -102,6 +103,7 @@ module NA
|
|
|
102
103
|
end
|
|
103
104
|
|
|
104
105
|
# colorize the action and highlight tags
|
|
106
|
+
@action.gsub!(/\{(.*?)\}/, '\\{\1\\}')
|
|
105
107
|
action = NA::Color.template("#{template[:action]}#{@action.sub(/ @#{NA.na_tag}\b/, '')}{x}")
|
|
106
108
|
action = action.highlight_tags(color: template[:tags],
|
|
107
109
|
parens: template[:value_parens],
|
|
@@ -184,7 +186,6 @@ module NA
|
|
|
184
186
|
return false if keys.empty?
|
|
185
187
|
|
|
186
188
|
key = keys[0]
|
|
187
|
-
|
|
188
189
|
return true if tag[:comp].nil?
|
|
189
190
|
|
|
190
191
|
tag_val = @tags[key]
|
data/lib/na/next_action.rb
CHANGED
|
@@ -139,10 +139,11 @@ module NA
|
|
|
139
139
|
todo.projects
|
|
140
140
|
end
|
|
141
141
|
|
|
142
|
-
def find_actions(target, search, tagged = nil, all: false, done: false)
|
|
142
|
+
def find_actions(target, search, tagged = nil, all: false, done: false, project: nil)
|
|
143
143
|
todo = NA::Todo.new({ search: search,
|
|
144
144
|
require_na: false,
|
|
145
145
|
file_path: target,
|
|
146
|
+
project: project,
|
|
146
147
|
tag: tagged,
|
|
147
148
|
done: done })
|
|
148
149
|
|
|
@@ -241,6 +242,7 @@ module NA
|
|
|
241
242
|
overwrite: false,
|
|
242
243
|
priority: 0,
|
|
243
244
|
project: nil,
|
|
245
|
+
move: nil,
|
|
244
246
|
remove_tag: [],
|
|
245
247
|
tagged: nil)
|
|
246
248
|
|
|
@@ -248,13 +250,14 @@ module NA
|
|
|
248
250
|
|
|
249
251
|
target_proj = nil
|
|
250
252
|
|
|
251
|
-
if
|
|
252
|
-
|
|
253
|
-
target_proj = projects.select { |pr| pr.project =~ /#{
|
|
253
|
+
if move
|
|
254
|
+
move = move.sub(/:$/, '')
|
|
255
|
+
target_proj = projects.select { |pr| pr.project =~ /#{move.gsub(/:/, '.*?:.*?')}/i }.first
|
|
254
256
|
if target_proj.nil?
|
|
255
|
-
res = NA.yn(NA::Color.template("#{NA.theme[:warning]}Project #{NA.theme[:file]}#{
|
|
257
|
+
res = NA.yn(NA::Color.template("#{NA.theme[:warning]}Project #{NA.theme[:file]}#{move}#{NA.theme[:warning]} doesn't exist, add it"), default: true)
|
|
256
258
|
if res
|
|
257
|
-
target_proj = insert_project(target,
|
|
259
|
+
target_proj = insert_project(target, move, projects)
|
|
260
|
+
projects << target_proj
|
|
258
261
|
else
|
|
259
262
|
NA.notify("#{NA.theme[:error]}Cancelled", exit_code: 1)
|
|
260
263
|
end
|
|
@@ -308,7 +311,7 @@ module NA
|
|
|
308
311
|
|
|
309
312
|
notify(add.pretty)
|
|
310
313
|
else
|
|
311
|
-
_, actions = find_actions(target, search, tagged, done: done, all: all)
|
|
314
|
+
_, actions = find_actions(target, search, tagged, done: done, all: all, project: project)
|
|
312
315
|
|
|
313
316
|
return if actions.nil?
|
|
314
317
|
|
|
@@ -489,23 +492,22 @@ module NA
|
|
|
489
492
|
tag: nil
|
|
490
493
|
}
|
|
491
494
|
opts = defaults.merge(options)
|
|
492
|
-
|
|
493
495
|
files = find_files(depth: options[:depth])
|
|
494
|
-
|
|
495
496
|
files.delete_if do |file|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
todo.
|
|
497
|
+
cmd_options = {
|
|
498
|
+
depth: options[:depth],
|
|
499
|
+
done: options[:done],
|
|
500
|
+
file_path: file,
|
|
501
|
+
negate: options[:negate],
|
|
502
|
+
project: options[:project],
|
|
503
|
+
query: options[:query],
|
|
504
|
+
regex: options[:regex],
|
|
505
|
+
require_na: options[:require_na],
|
|
506
|
+
search: options[:search],
|
|
507
|
+
tag: options[:tag]
|
|
508
|
+
}
|
|
509
|
+
todo = NA::Todo.new(cmd_options)
|
|
510
|
+
todo.actions.empty?
|
|
509
511
|
end
|
|
510
512
|
|
|
511
513
|
files
|
data/lib/na/todo.rb
CHANGED
|
@@ -61,7 +61,7 @@ module NA
|
|
|
61
61
|
required_tag.push(t) if t[:required] && t[:negate]
|
|
62
62
|
negated_tag.push(t) unless t[:negate]
|
|
63
63
|
else
|
|
64
|
-
optional_tag.push(t) unless t[:negate]
|
|
64
|
+
optional_tag.push(t) unless t[:negate] || t[:required]
|
|
65
65
|
required_tag.push(t) if t[:required] && !t[:negate]
|
|
66
66
|
negated_tag.push(t) if t[:negate]
|
|
67
67
|
end
|
|
@@ -133,11 +133,9 @@ module NA
|
|
|
133
133
|
next if settings[:require_na] && !line.na?
|
|
134
134
|
|
|
135
135
|
has_search = !optional.empty? || !required.empty? || !negated.empty?
|
|
136
|
-
|
|
137
136
|
next if has_search && !new_action.search_match?(any: optional,
|
|
138
137
|
all: required,
|
|
139
138
|
none: negated)
|
|
140
|
-
|
|
141
139
|
if settings[:project]
|
|
142
140
|
rx = settings[:project].split(%r{[/:]}).join('.*?/')
|
|
143
141
|
next unless parent.join('/') =~ Regexp.new("#{rx}.*?", Regexp::IGNORECASE)
|
data/lib/na/version.rb
CHANGED
data/src/_README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
_If you're one of the rare people like me who find this useful, feel free to
|
|
10
10
|
[buy me some coffee][donate]._
|
|
11
11
|
|
|
12
|
-
The current version of `na` is <!--VER-->1.2.
|
|
12
|
+
The current version of `na` is <!--VER-->1.2.45<!--END VER-->.
|
|
13
13
|
|
|
14
14
|
`na` ("next action") is a command line tool designed to make it easy to see what your next actions are for any project, right from the command line. It works with TaskPaper-formatted files (but any plain text format will do), looking for `@na` tags (or whatever you specify) in todo files in your current folder.
|
|
15
15
|
|