na 1.2.20 → 1.2.22

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20a02c7a0e5644aa0aef147e434a8d6dc9daa1705a50e9563255a7c2f6688267
4
- data.tar.gz: a097a253c572eb83c2fd74b6ba978fbbe5f328d804cdd309af6a6e66e682d384
3
+ metadata.gz: ccb815bfd051b4cd15b198c14ff1bb1efcde847005d88aa4322d88aec4ac8d72
4
+ data.tar.gz: 75ce04d2a86f842668118e5e58497627c5616618479b7838f4f6fcd34baf910a
5
5
  SHA512:
6
- metadata.gz: 33c341298f6c7855dce8541f185aa46bf2d7d08cb5f97d709fda5fe1e0cf1537cec96297c80a88b1e69fb9089c7d15219d943dc4704a3fcca60be58b0e430ff6
7
- data.tar.gz: 3c000719d4b5d7d2f6713c1865cdcc713878eac017379e40fffc98199843abbb23c4517b0a621ed80ae1b7d8a11d35633f820c48c38c8261ff833d39e23ae675
6
+ metadata.gz: 2cee616b47b7ee5918d9062a48f38ff45ec4ee6a20fe3027b31c778d4fe7d08881ac5138498cc02b1e66c691c925a35f8b3d72a1ca23d034b48853ad7ac87540
7
+ data.tar.gz: d262fb01720b1b9daa30c26b75ef1771e047ba8879cc04ca66be6076a7c99aa143ed3d2a0b254785bee0c0f95fa76ab0cbf282199dc3fd0867c1ec12edc81df2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ### 1.2.22
2
+
3
+ 2023-06-05 10:35
4
+
5
+ #### NEW
6
+
7
+ - Global `--template PATH` option to define a template for new files, can be added to .na.rc
8
+
9
+ #### IMPROVED
10
+
11
+ - Help verbiage and examples
12
+
13
+ #### FIXED
14
+
15
+ - Variable assignment warnings
16
+
1
17
  ### 1.2.20
2
18
 
3
19
  2023-05-09 10:40
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- na (1.2.20)
4
+ na (1.2.22)
5
5
  chronic (~> 0.10, >= 0.10.2)
6
6
  gli (~> 2.21.0)
7
7
  mdless (~> 1.0, >= 1.0.32)
@@ -33,6 +33,7 @@ GEM
33
33
  PLATFORMS
34
34
  arm64-darwin-20
35
35
  arm64-darwin-21
36
+ x86_64-darwin-20
36
37
 
37
38
  DEPENDENCIES
38
39
  minitest (~> 5.14)
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.20
12
+ The current version of `na` is 1.2.22
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,13 +77,14 @@ SYNOPSIS
77
77
  na [global options] command [command options] [arguments...]
78
78
 
79
79
  VERSION
80
- 1.2.20
80
+ 1.2.22
81
81
 
82
82
  GLOBAL OPTIONS
83
- -a, --[no-]add - Add a next action (deprecated, for backwards compatibility)
83
+ -a, --add - Add a next action (deprecated, for backwards compatibility)
84
84
  --add_at=POSITION - Add all new/moved entries at [s]tart or [e]nd of target project (default: start)
85
+ --[no-]color - Colorize output (default: enabled)
85
86
  --cwd_as=TYPE - Use current working directory as [p]roject, [t]ag, or [n]one (default: none)
86
- -d, --depth=DEPTH - Recurse to depth (default: 3)
87
+ -d, --depth=DEPTH - Recurse to depth (default: 1)
87
88
  --[no-]debug - Display verbose output
88
89
  --ext=EXT - File extension to consider a todo file (default: taskpaper)
89
90
  -f, --file=PATH - Use a single file as global todo, use --initconfig to make permanent (default: none)
@@ -92,6 +93,7 @@ GLOBAL OPTIONS
92
93
  -p, --priority=PRIORITY - Set a priority 0-5 (deprecated, for backwards compatibility) (default: none)
93
94
  -r, --[no-]recurse - Recurse 3 directories deep (deprecated, for backwards compatability)
94
95
  -t, --na_tag=TAG - Tag to consider a next action (default: na)
96
+ --template=PATH - Provide a template for new/blank todo files, use --initconfig to make permanent (default: none)
95
97
  --version - Display the program version
96
98
 
97
99
  COMMANDS
@@ -203,17 +205,17 @@ SYNOPSIS
203
205
  na [global options] find [command options] PATTERN
204
206
 
205
207
  DESCRIPTION
206
- Search tokens are separated by spaces. Actions matching all tokens in the pattern will be shown (partial matches allowed). Add a + before a token to make it required, e.g. `na find +feature +maybe`
208
+ Search tokens are separated by spaces. Actions matching all tokens in the pattern will be shown (partial matches allowed). Add a + before a token to make it required, e.g. `na find +feature +maybe`, add a - or ! to ignore matches containing that token.
207
209
 
208
210
  COMMAND OPTIONS
209
211
  -d, --depth=DEPTH - Recurse to depth (default: none)
210
212
  --[no-]done - Include @done actions
211
213
  -e, --regex - Interpret search pattern as regular expression
212
214
  --in=TODO_PATH - Show actions from a specific todo file in history. May use wildcards (* and ?) (default: none)
213
- --[no-]nest - Output actions nested by file
215
+ --nest - Output actions nested by file
214
216
  --[no-]notes - Include notes in output
215
217
  -o, --or - Combine search tokens with OR, displaying actions matching ANY of the terms
216
- --[no-]omnifocus - Output actions nested by file and project
218
+ --omnifocus - Output actions nested by file and project
217
219
  --proj, --project=PROJECT[/SUBPROJECT] - Show actions from a specific project (default: none)
218
220
  --save=TITLE - Save this search for future use (default: none)
219
221
  --tagged=TAG - Match actions containing tag. Allows value comparisons (may be used more than once, default: none)
@@ -225,6 +227,9 @@ EXAMPLES
225
227
  # Find all actions containing feature, idea, and swift
226
228
  na find feature idea swift
227
229
 
230
+ # Find all actions containing feature and idea but NOT swift
231
+ na find feature idea -swift
232
+
228
233
  # Find all actions containing the exact text "feature idea"
229
234
  na find -x feature idea
230
235
  ```
@@ -272,13 +277,13 @@ DESCRIPTION
272
277
  COMMAND OPTIONS
273
278
  -d, --depth=DEPTH - Recurse to depth (default: none)
274
279
  --[no-]done - Include @done actions
275
- --[no-]exact - Search query is exact text match (not tokens)
280
+ --exact - Search query is exact text match (not tokens)
276
281
  --in, --todo=TODO_FILE - Display matches from a known todo file (may be used more than once, default: none)
277
- --[no-]nest - Output actions nested by file
282
+ --nest - Output actions nested by file
278
283
  --[no-]notes - Include notes in output
279
- --[no-]omnifocus - Output actions nested by file and project
284
+ --omnifocus - Output actions nested by file and project
280
285
  --proj, --project=PROJECT[/SUBPROJECT] - Show actions from a specific project (default: none)
281
- --[no-]regex - Search query is regular expression
286
+ --regex - Search query is regular expression
282
287
  --search=QUERY - Filter results using search terms (may be used more than once, default: none)
283
288
  -t, --tag=TAG - Alternate tag to search for (default: none)
284
289
  --tagged=TAG - Match actions containing tag. Allows value comparisons (may be used more than once, default: none)
@@ -338,8 +343,8 @@ DESCRIPTION
338
343
  Run without argument to list saved searches
339
344
 
340
345
  COMMAND OPTIONS
341
- -d, --[no-]delete - Delete the specified search definition
342
- -e, --[no-]edit - Open the saved search file in $EDITOR
346
+ -d, --delete - Delete the specified search definition
347
+ -e, --edit - Open the saved search file in $EDITOR
343
348
 
344
349
  EXAMPLES
345
350
 
@@ -378,13 +383,13 @@ DESCRIPTION
378
383
  COMMAND OPTIONS
379
384
  -d, --depth=DEPTH - Recurse to depth (default: none)
380
385
  --[no-]done - Include @done actions
381
- --[no-]exact - Search query is exact text match (not tokens)
386
+ --exact - Search query is exact text match (not tokens)
382
387
  --in, --todo=TODO_FILE - Display matches from a known todo file (may be used more than once, default: none)
383
- --[no-]nest - Output actions nested by file
388
+ --nest - Output actions nested by file
384
389
  --[no-]notes - Include notes in output
385
- --[no-]omnifocus - Output actions nested by file and project
390
+ --omnifocus - Output actions nested by file and project
386
391
  --proj, --project=PROJECT[/SUBPROJECT] - Show actions from a specific project (default: none)
387
- --[no-]regex - Search query is regular expression
392
+ --regex - Search query is regular expression
388
393
  --search=QUERY - Filter results using search terms (may be used more than once, default: none)
389
394
  -t, --tag=TAG - Alternate tag to search for (default: none)
390
395
  --tagged=TAG - Match actions containing tag. Allows value comparisons (may be used more than once, default: none)
data/bin/na CHANGED
@@ -34,7 +34,10 @@ class App
34
34
  NA::Color.coloring = $stdin.isatty
35
35
 
36
36
  desc 'Add a next action (deprecated, for backwards compatibility)'
37
- switch %i[a add]
37
+ switch %i[a add], negatable: false
38
+
39
+ desc 'Colorize output'
40
+ switch %i[color], negatable: true, default_value: true
38
41
 
39
42
  desc 'Set a priority 0-5 (deprecated, for backwards compatibility)'
40
43
  arg_name 'PRIORITY'
@@ -44,6 +47,10 @@ class App
44
47
  arg_name 'PATH'
45
48
  flag %i[f file]
46
49
 
50
+ desc 'Provide a template for new/blank todo files, use --initconfig to make permanent'
51
+ arg_name 'PATH'
52
+ flag %[template]
53
+
47
54
  desc 'Use current working directory as [p]roject, [t]ag, or [n]one'
48
55
  arg_name 'TYPE'
49
56
  flag %i[cwd_as], must_match: /^[ptn].*?$/i, default_value: 'none'
@@ -104,10 +111,10 @@ class App
104
111
  c.flag %i[search], multiple: true
105
112
 
106
113
  c.desc 'Search query is regular expression'
107
- c.switch %i[regex]
114
+ c.switch %i[regex], negatable: false
108
115
 
109
116
  c.desc 'Search query is exact text match (not tokens)'
110
- c.switch %i[exact]
117
+ c.switch %i[exact], negatable: false
111
118
 
112
119
  c.desc 'Include notes in output'
113
120
  c.switch %i[notes], negatable: true, default_value: false
@@ -116,10 +123,10 @@ class App
116
123
  c.switch %i[done]
117
124
 
118
125
  c.desc 'Output actions nested by file'
119
- c.switch %[nest]
126
+ c.switch %[nest], negatable: false
120
127
 
121
128
  c.desc 'Output actions nested by file and project'
122
- c.switch %[omnifocus]
129
+ c.switch %[omnifocus], negatable: false
123
130
 
124
131
  c.action do |global_options, options, args|
125
132
  if global_options[:add]
@@ -248,7 +255,7 @@ class App
248
255
  c.flag %i[t tag]
249
256
 
250
257
  c.desc 'Don\'t add next action tag to new entry'
251
- c.switch %i[x]
258
+ c.switch %i[x], negatable: false
252
259
 
253
260
  c.desc 'Specify the file to which the task should be added'
254
261
  c.arg_name 'PATH'
@@ -616,10 +623,12 @@ class App
616
623
 
617
624
  desc 'Find actions matching a search pattern'
618
625
  long_desc 'Search tokens are separated by spaces. Actions matching all tokens in the pattern will be shown
619
- (partial matches allowed). Add a + before a token to make it required, e.g. `na find +feature +maybe`'
626
+ (partial matches allowed). Add a + before a token to make it required, e.g. `na find +feature +maybe`,
627
+ add a - or ! to ignore matches containing that token.'
620
628
  arg_name 'PATTERN'
621
629
  command %i[find grep] do |c|
622
630
  c.example 'na find feature idea swift', desc: 'Find all actions containing feature, idea, and swift'
631
+ c.example 'na find feature idea -swift', desc: 'Find all actions containing feature and idea but NOT swift'
623
632
  c.example 'na find -x feature idea', desc: 'Find all actions containing the exact text "feature idea"'
624
633
 
625
634
  c.desc 'Interpret search pattern as regular expression'
@@ -661,10 +670,10 @@ class App
661
670
  c.flag %i[save]
662
671
 
663
672
  c.desc 'Output actions nested by file'
664
- c.switch %[nest]
673
+ c.switch %[nest], negatable: false
665
674
 
666
675
  c.desc 'Output actions nested by file and project'
667
- c.switch %[omnifocus]
676
+ c.switch %[omnifocus], negatable: false
668
677
 
669
678
  c.action do |global_options, options, args|
670
679
  options[:nest] = true if options[:omnifocus]
@@ -785,10 +794,10 @@ class App
785
794
  c.flag %i[search], multiple: true
786
795
 
787
796
  c.desc 'Search query is regular expression'
788
- c.switch %i[regex]
797
+ c.switch %i[regex], negatable: false
789
798
 
790
799
  c.desc 'Search query is exact text match (not tokens)'
791
- c.switch %i[exact]
800
+ c.switch %i[exact], negatable: false
792
801
 
793
802
  c.desc 'Include @done actions'
794
803
  c.switch %i[done]
@@ -801,10 +810,10 @@ class App
801
810
  c.flag %i[save]
802
811
 
803
812
  c.desc 'Output actions nested by file'
804
- c.switch %[nest]
813
+ c.switch %[nest], negatable: false
805
814
 
806
815
  c.desc 'Output actions nested by file and project'
807
- c.switch %[omnifocus]
816
+ c.switch %[omnifocus], negatable: false
808
817
 
809
818
  c.action do |global_options, options, args|
810
819
  options[:nest] = true if options[:omnifocus]
@@ -1095,16 +1104,16 @@ class App
1095
1104
  c.example 'na tagged "+maybe,+priority<=3" --save maybelater', description: 'save a search called "maybelater"'
1096
1105
  c.example 'na saved maybelater', description: 'perform the search named "maybelater"'
1097
1106
  c.example 'na saved maybe',
1098
- description: 'perform the search named "maybelater", assuming no other searches match "may"'
1107
+ description: 'perform the search named "maybelater", assuming no other searches match "maybe"'
1099
1108
  c.example 'na maybe',
1100
1109
  description: 'na run with no command and a single argument automatically performs a matching saved search'
1101
1110
  c.example 'na saved', description: 'list available searches'
1102
1111
 
1103
1112
  c.desc 'Open the saved search file in $EDITOR'
1104
- c.switch %i[e edit]
1113
+ c.switch %i[e edit], negatable: false
1105
1114
 
1106
1115
  c.desc 'Delete the specified search definition'
1107
- c.switch %i[d delete]
1116
+ c.switch %i[d delete], negatable: false
1108
1117
 
1109
1118
  c.action do |_global_options, options, args|
1110
1119
  NA.edit_searches if options[:edit]
@@ -1128,6 +1137,7 @@ class App
1128
1137
 
1129
1138
  pre do |global, _command, _options, _args|
1130
1139
  NA.verbose = global[:debug]
1140
+ NA::Color.coloring = global[:color]
1131
1141
  NA.extension = global[:ext]
1132
1142
  NA.na_tag = global[:na_tag]
1133
1143
  NA.global_file = global[:file]
data/lib/na/action.rb CHANGED
@@ -24,7 +24,7 @@ module NA
24
24
  else
25
25
  ''
26
26
  end
27
- "(#{@file}:#{@line}) #{@project}:#{@parent.join('>')} | #{@action}#{@note}"
27
+ "(#{@file}:#{@line}) #{@project}:#{@parent.join('>')} | #{@action}#{note}"
28
28
  end
29
29
 
30
30
  def inspect
data/lib/na/colors.rb CHANGED
@@ -226,6 +226,7 @@ module NA
226
226
  ##
227
227
  def template(input)
228
228
  input = input.join(' ') if input.is_a? Array
229
+ return input.gsub(/(?<!\\)\{(\w+)\}/i, '') unless NA::Color.coloring?
229
230
 
230
231
  fmt = input.gsub(/%/, '%%')
231
232
  fmt = fmt.gsub(/(?<!\\)\{(\w+)\}/i) do
@@ -305,7 +306,7 @@ module NA
305
306
  %w[r g b].each do |e|
306
307
  t << parts[e].hex
307
308
  end
308
- color =
309
+
309
310
  "\e[#{is_bg ? '48' : '38'};2;#{t.join(';')}m"
310
311
  end
311
312
 
@@ -72,21 +72,25 @@ module NA
72
72
  ## @param target [String] The target path
73
73
  ## @param basename [String] The project base name
74
74
  ##
75
- def create_todo(target, basename)
75
+ def create_todo(target, basename, template: nil)
76
76
  File.open(target, 'w') do |f|
77
- content = <<~ENDCONTENT
78
- Inbox:
79
- #{basename}:
80
- \tFeature Requests:
81
- \tIdeas:
82
- \tBugs:
83
- Archive:
84
- Search Definitions:
85
- \tTop Priority @search(@priority = 5 and not @done)
86
- \tHigh Priority @search(@priority > 3 and not @done)
87
- \tMaybe @search(@maybe)
88
- \tNext @search(@#{NA.na_tag} and not @done and not project = \"Archive\")
89
- ENDCONTENT
77
+ if template && File.exist?(template)
78
+ content = IO.read(template)
79
+ else
80
+ content = <<~ENDCONTENT
81
+ Inbox:
82
+ #{basename}:
83
+ \tFeature Requests:
84
+ \tIdeas:
85
+ \tBugs:
86
+ Archive:
87
+ Search Definitions:
88
+ \tTop Priority @search(@priority = 5 and not @done)
89
+ \tHigh Priority @search(@priority > 3 and not @done)
90
+ \tMaybe @search(@maybe)
91
+ \tNext @search(@#{NA.na_tag} and not @done and not project = \"Archive\")
92
+ ENDCONTENT
93
+ end
90
94
  f.puts(content)
91
95
  end
92
96
  save_working_dir(target)
@@ -600,7 +604,6 @@ module NA
600
604
  content = file.read_file
601
605
  indent_level = 0
602
606
  parent = []
603
- last_line = 0
604
607
  in_action = false
605
608
  content.split("\n").each.with_index do |line, idx|
606
609
  if line.project?
data/lib/na/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Na
2
- VERSION = '1.2.20'
2
+ VERSION = '1.2.22'
3
3
  end
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.19<!--END VER-->.
12
+ The current version of `na` is <!--VER-->1.2.21<!--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
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: na
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.20
4
+ version: 1.2.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-09 00:00:00.000000000 Z
11
+ date: 2023-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
246
  - !ruby/object:Gem::Version
247
247
  version: '0'
248
248
  requirements: []
249
- rubygems_version: 3.2.16
249
+ rubygems_version: 3.2.15
250
250
  signing_key:
251
251
  specification_version: 4
252
252
  summary: A command line tool for adding and listing project todos