na 1.2.17 → 1.2.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/Gemfile.lock +1 -1
- data/README.md +5 -2
- data/bin/na +19 -3
- data/lib/na/next_action.rb +54 -15
- data/lib/na/string.rb +9 -0
- 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: 8c8bbd644e758263ac0301010b89259ad0e97debaba7d1cdfe51f4fd67e4c323
|
4
|
+
data.tar.gz: 8f0a1f3e385f8b82b2afd376d2316e43d993493bf10974fc82040de6d4b89a28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aad67239d2046f7347700da92676ae0c3652631413fbc0c17d533036007f0b5147d1d8b161b1b38aaecf124c5740077faf42b8dcc6cff6a76d37fe7398758d62
|
7
|
+
data.tar.gz: 2cf613349b29074b015e7394ba659b8200451eb950b965137b5c3b4a7a41108b98a70b4e66ac1bc3f6b23cd821b31de3a53db37cec8b662705af4af72042e334
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
### 1.2.19
|
2
|
+
|
3
|
+
2023-01-17 16:49
|
4
|
+
|
5
|
+
#### IMPROVED
|
6
|
+
|
7
|
+
- `--nest` flag creates a flat list with project included in task title, `--omnifocus` creates OmniFocus-compatible project nesting
|
8
|
+
|
9
|
+
### 1.2.18
|
10
|
+
|
11
|
+
2023-01-17 13:38
|
12
|
+
|
13
|
+
#### IMPROVED
|
14
|
+
|
15
|
+
- Format tags OmniFocus wouldn't recognize as @tags(TAG) in --nest output
|
16
|
+
- Include notes in --nest output
|
17
|
+
|
1
18
|
### 1.2.17
|
2
19
|
|
3
20
|
2023-01-17 11:23
|
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.19
|
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.19
|
81
81
|
|
82
82
|
GLOBAL OPTIONS
|
83
83
|
-a, --[no-]add - Add a next action (deprecated, for backwards compatibility)
|
@@ -213,6 +213,7 @@ COMMAND OPTIONS
|
|
213
213
|
--[no-]nest - Output actions nested by file
|
214
214
|
--[no-]notes - Include notes in output
|
215
215
|
-o, --or - Combine search tokens with OR, displaying actions matching ANY of the terms
|
216
|
+
--[no-]omnifocus - Output actions nested by file and project
|
216
217
|
--proj, --project=PROJECT[/SUBPROJECT] - Show actions from a specific project (default: none)
|
217
218
|
--save=TITLE - Save this search for future use (default: none)
|
218
219
|
--tagged=TAG - Match actions containing tag. Allows value comparisons (may be used more than once, default: none)
|
@@ -275,6 +276,7 @@ COMMAND OPTIONS
|
|
275
276
|
--in, --todo=TODO_FILE - Display matches from a known todo file (may be used more than once, default: none)
|
276
277
|
--[no-]nest - Output actions nested by file
|
277
278
|
--[no-]notes - Include notes in output
|
279
|
+
--[no-]omnifocus - Output actions nested by file and project
|
278
280
|
--proj, --project=PROJECT[/SUBPROJECT] - Show actions from a specific project (default: none)
|
279
281
|
--[no-]regex - Search query is regular expression
|
280
282
|
--search=QUERY - Filter results using search terms (may be used more than once, default: none)
|
@@ -380,6 +382,7 @@ COMMAND OPTIONS
|
|
380
382
|
--in, --todo=TODO_FILE - Display matches from a known todo file (may be used more than once, default: none)
|
381
383
|
--[no-]nest - Output actions nested by file
|
382
384
|
--[no-]notes - Include notes in output
|
385
|
+
--[no-]omnifocus - Output actions nested by file and project
|
383
386
|
--proj, --project=PROJECT[/SUBPROJECT] - Show actions from a specific project (default: none)
|
384
387
|
--[no-]regex - Search query is regular expression
|
385
388
|
--search=QUERY - Filter results using search terms (may be used more than once, default: none)
|
data/bin/na
CHANGED
@@ -118,6 +118,9 @@ class App
|
|
118
118
|
c.desc 'Output actions nested by file'
|
119
119
|
c.switch %[nest]
|
120
120
|
|
121
|
+
c.desc 'Output actions nested by file and project'
|
122
|
+
c.switch %[omnifocus]
|
123
|
+
|
121
124
|
c.action do |global_options, options, args|
|
122
125
|
if global_options[:add]
|
123
126
|
cmd = ['add']
|
@@ -128,6 +131,8 @@ class App
|
|
128
131
|
exit run(cmd)
|
129
132
|
end
|
130
133
|
|
134
|
+
options[:nest] = true if options[:omnifocus]
|
135
|
+
|
131
136
|
depth = if global_options[:recurse] && options[:depth].nil? && global_options[:depth] == 1
|
132
137
|
3
|
133
138
|
else
|
@@ -199,7 +204,7 @@ class App
|
|
199
204
|
project: options[:project],
|
200
205
|
require_na: require_na)
|
201
206
|
|
202
|
-
NA.output_actions(actions, depth, files: files, notes: options[:notes], nest: options[:nest])
|
207
|
+
NA.output_actions(actions, depth, files: files, notes: options[:notes], nest: options[:nest], nest_projects: options[:omnifocus])
|
203
208
|
end
|
204
209
|
end
|
205
210
|
|
@@ -658,12 +663,18 @@ class App
|
|
658
663
|
c.desc 'Output actions nested by file'
|
659
664
|
c.switch %[nest]
|
660
665
|
|
666
|
+
c.desc 'Output actions nested by file and project'
|
667
|
+
c.switch %[omnifocus]
|
668
|
+
|
661
669
|
c.action do |global_options, options, args|
|
670
|
+
options[:nest] = true if options[:omnifocus]
|
671
|
+
|
662
672
|
if options[:save]
|
663
673
|
title = options[:save].gsub(/[^a-z0-9]/, '_').gsub(/_+/, '_')
|
664
674
|
NA.save_search(title, "#{NA.command_line.join(' ').sub(/ --save[= ]*\S+/, '').split(' ').map { |t| %("#{t}") }.join(' ')}")
|
665
675
|
end
|
666
676
|
|
677
|
+
|
667
678
|
depth = if global_options[:recurse] && options[:depth].nil? && global_options[:depth] == 1
|
668
679
|
3
|
669
680
|
else
|
@@ -731,7 +742,7 @@ class App
|
|
731
742
|
[tokens]
|
732
743
|
end
|
733
744
|
|
734
|
-
NA.output_actions(actions, depth, files: files, regexes: regexes, notes: options[:notes], nest: options[:nest])
|
745
|
+
NA.output_actions(actions, depth, files: files, regexes: regexes, notes: options[:notes], nest: options[:nest], nest_projects: options[:omnifocus])
|
735
746
|
end
|
736
747
|
end
|
737
748
|
|
@@ -792,7 +803,12 @@ class App
|
|
792
803
|
c.desc 'Output actions nested by file'
|
793
804
|
c.switch %[nest]
|
794
805
|
|
806
|
+
c.desc 'Output actions nested by file and project'
|
807
|
+
c.switch %[omnifocus]
|
808
|
+
|
795
809
|
c.action do |global_options, options, args|
|
810
|
+
options[:nest] = true if options[:omnifocus]
|
811
|
+
|
796
812
|
if options[:save]
|
797
813
|
title = options[:save].gsub(/[^a-z0-9]/, '_').gsub(/_+/, '_')
|
798
814
|
NA.save_search(title, "#{NA.command_line.join(' ').sub(/ --save[= ]*\S+/, '').split(' ').map { |t| %("#{t}") }.join(' ')}")
|
@@ -871,7 +887,7 @@ class App
|
|
871
887
|
else
|
872
888
|
[tokens]
|
873
889
|
end
|
874
|
-
NA.output_actions(actions, depth, files: files, regexes: regexes, notes: options[:notes], nest: options[:nest])
|
890
|
+
NA.output_actions(actions, depth, files: files, regexes: regexes, notes: options[:notes], nest: options[:nest], nest_projects: options[:omnifocus])
|
875
891
|
end
|
876
892
|
end
|
877
893
|
|
data/lib/na/next_action.rb
CHANGED
@@ -414,7 +414,7 @@ module NA
|
|
414
414
|
current_parent = current_parent[par]
|
415
415
|
end
|
416
416
|
|
417
|
-
current_parent[:actions].push(a
|
417
|
+
current_parent[:actions].push(a)
|
418
418
|
end
|
419
419
|
parents
|
420
420
|
end
|
@@ -425,7 +425,27 @@ module NA
|
|
425
425
|
children.each do |k, v|
|
426
426
|
if k.to_s =~ /actions/
|
427
427
|
indent += "\t"
|
428
|
-
|
428
|
+
|
429
|
+
v.each do |a|
|
430
|
+
item = "#{indent}- #{a.action}"
|
431
|
+
|
432
|
+
unless a.tags.empty?
|
433
|
+
tags = []
|
434
|
+
a.tags.each do |key, val|
|
435
|
+
next if key =~ /^(due|flagged|done)$/
|
436
|
+
|
437
|
+
tag = key
|
438
|
+
tag += "-#{val}" unless val.nil? || val.empty?
|
439
|
+
tags.push(tag)
|
440
|
+
end
|
441
|
+
|
442
|
+
item += " @tags(#{tags.join(',')})" unless tags.empty?
|
443
|
+
end
|
444
|
+
|
445
|
+
item += "\n#{indent}\t#{a.note.join("\n#{indent}\t")}" unless a.note.empty?
|
446
|
+
|
447
|
+
out.push(item)
|
448
|
+
end
|
429
449
|
else
|
430
450
|
out.push("#{indent}#{k}:")
|
431
451
|
out.concat(output_children(v, level + 1))
|
@@ -442,31 +462,50 @@ module NA
|
|
442
462
|
## @param files [Array] The files actions originally came from
|
443
463
|
## @param regexes [Array] The regexes used to gather actions
|
444
464
|
##
|
445
|
-
def output_actions(actions, depth, files: nil, regexes: [], notes: false, nest: false)
|
465
|
+
def output_actions(actions, depth, files: nil, regexes: [], notes: false, nest: false, nest_projects: false)
|
446
466
|
return if files.nil?
|
447
467
|
|
448
468
|
if nest
|
449
469
|
template = '%parent%action'
|
450
470
|
|
451
471
|
parent_files = {}
|
472
|
+
out = []
|
452
473
|
|
453
|
-
|
454
|
-
|
455
|
-
parent_files
|
456
|
-
|
457
|
-
|
474
|
+
if nest_projects
|
475
|
+
actions.each do |action|
|
476
|
+
if parent_files.key?(action.file)
|
477
|
+
parent_files[action.file].push(action)
|
478
|
+
else
|
479
|
+
parent_files[action.file] = [action]
|
480
|
+
end
|
458
481
|
end
|
459
|
-
end
|
460
482
|
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
483
|
+
parent_files.each do |file, acts|
|
484
|
+
projects = project_hierarchy(acts)
|
485
|
+
out.push("#{file.sub(%r{^./}, '').shorten_path}:")
|
486
|
+
out.concat(output_children(projects, 0))
|
487
|
+
end
|
488
|
+
else
|
489
|
+
template = '%parent%action'
|
490
|
+
|
491
|
+
actions.each do |action|
|
492
|
+
if parent_files.key?(action.file)
|
493
|
+
parent_files[action.file].push(action)
|
494
|
+
else
|
495
|
+
parent_files[action.file] = [action]
|
496
|
+
end
|
497
|
+
end
|
498
|
+
|
499
|
+
parent_files.each do |k, v|
|
500
|
+
out.push("#{k.sub(%r{^\./}, '')}:")
|
501
|
+
v.each do |a|
|
502
|
+
out.push("\t- [#{a.parent.join('/')}] #{a.action}")
|
503
|
+
out.push("\t\t#{a.note.join("\n\t\t")}") unless a.note.empty?
|
504
|
+
end
|
505
|
+
end
|
466
506
|
end
|
467
507
|
puts out.join("\n")
|
468
508
|
else
|
469
|
-
|
470
509
|
template = if files.count.positive?
|
471
510
|
if files.count == 1
|
472
511
|
'%parent%action'
|
data/lib/na/string.rb
CHANGED
@@ -167,6 +167,15 @@ class ::String
|
|
167
167
|
end
|
168
168
|
end
|
169
169
|
|
170
|
+
##
|
171
|
+
## Replace home directory with tilde
|
172
|
+
##
|
173
|
+
## @return [String] shortened path
|
174
|
+
##
|
175
|
+
def shorten_path
|
176
|
+
sub(/^#{ENV['HOME']}/, '~')
|
177
|
+
end
|
178
|
+
|
170
179
|
private
|
171
180
|
|
172
181
|
def matches_none(regexes)
|
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.18<!--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
|
|