na 1.2.18 → 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 +8 -0
- data/Gemfile.lock +1 -1
- data/README.md +5 -2
- data/bin/na +19 -3
- data/lib/na/next_action.rb +37 -18
- 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
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
@@ -431,18 +431,18 @@ module NA
|
|
431
431
|
|
432
432
|
unless a.tags.empty?
|
433
433
|
tags = []
|
434
|
-
a.tags.each do |
|
435
|
-
next if
|
434
|
+
a.tags.each do |key, val|
|
435
|
+
next if key =~ /^(due|flagged|done)$/
|
436
436
|
|
437
|
-
tag =
|
438
|
-
tag += "-#{
|
437
|
+
tag = key
|
438
|
+
tag += "-#{val}" unless val.nil? || val.empty?
|
439
439
|
tags.push(tag)
|
440
440
|
end
|
441
441
|
|
442
442
|
item += " @tags(#{tags.join(',')})" unless tags.empty?
|
443
443
|
end
|
444
444
|
|
445
|
-
item += "\n#{indent}\t#{a.note.join("\n#{indent}\t")}"
|
445
|
+
item += "\n#{indent}\t#{a.note.join("\n#{indent}\t")}" unless a.note.empty?
|
446
446
|
|
447
447
|
out.push(item)
|
448
448
|
end
|
@@ -462,31 +462,50 @@ module NA
|
|
462
462
|
## @param files [Array] The files actions originally came from
|
463
463
|
## @param regexes [Array] The regexes used to gather actions
|
464
464
|
##
|
465
|
-
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)
|
466
466
|
return if files.nil?
|
467
467
|
|
468
468
|
if nest
|
469
469
|
template = '%parent%action'
|
470
470
|
|
471
471
|
parent_files = {}
|
472
|
+
out = []
|
472
473
|
|
473
|
-
|
474
|
-
|
475
|
-
parent_files
|
476
|
-
|
477
|
-
|
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
|
478
481
|
end
|
479
|
-
end
|
480
482
|
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
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
|
486
506
|
end
|
487
507
|
puts out.join("\n")
|
488
508
|
else
|
489
|
-
|
490
509
|
template = if files.count.positive?
|
491
510
|
if files.count == 1
|
492
511
|
'%parent%action'
|
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
|
|