na 1.2.18 → 1.2.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 580a58387aafdf48e220483783dff100a26f370e5ac685239dcf2cff416793cc
4
- data.tar.gz: 04ec4cd4089b00ab65688e6fb88509971f01ef605b88956e9ecf4e523b175067
3
+ metadata.gz: 20a02c7a0e5644aa0aef147e434a8d6dc9daa1705a50e9563255a7c2f6688267
4
+ data.tar.gz: a097a253c572eb83c2fd74b6ba978fbbe5f328d804cdd309af6a6e66e682d384
5
5
  SHA512:
6
- metadata.gz: 4ff3cd0df2c68db3baa5022d5d9cb6dc7f61684aef2b50485cf4022ea4169dcc547b433fd2e42e454c21e29fb8dcd4f04fc7caaf9ae64de9e42dd0c57d4a882d
7
- data.tar.gz: da239f2e39fbfbc514c321867b1068b1cc1e16e02e6b068cc1cd53024354baac2955442d0db8aed9ff495bb62ed68116f1f06ae6c0ddc0915cbe168ddc2a91b9
6
+ metadata.gz: 33c341298f6c7855dce8541f185aa46bf2d7d08cb5f97d709fda5fe1e0cf1537cec96297c80a88b1e69fb9089c7d15219d943dc4704a3fcca60be58b0e430ff6
7
+ data.tar.gz: 3c000719d4b5d7d2f6713c1865cdcc713878eac017379e40fffc98199843abbb23c4517b0a621ed80ae1b7d8a11d35633f820c48c38c8261ff833d39e23ae675
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ### 1.2.20
2
+
3
+ 2023-05-09 10:40
4
+
5
+ #### FIXED
6
+
7
+ - Allow single character projects
8
+ - Allow parens in project title
9
+
10
+ ### 1.2.19
11
+
12
+ 2023-01-17 16:49
13
+
14
+ #### IMPROVED
15
+
16
+ - `--nest` flag creates a flat list with project included in task title, `--omnifocus` creates OmniFocus-compatible project nesting
17
+
1
18
  ### 1.2.18
2
19
 
3
20
  2023-01-17 13:38
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- na (1.2.18)
4
+ na (1.2.20)
5
5
  chronic (~> 0.10, >= 0.10.2)
6
6
  gli (~> 2.21.0)
7
7
  mdless (~> 1.0, >= 1.0.32)
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.18
12
+ The current version of `na` is 1.2.20
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.18
80
+ 1.2.20
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/Rakefile CHANGED
@@ -15,7 +15,7 @@ task :doc, [*Rake.application[:yard].arg_names] => [:yard]
15
15
  Rake::RDocTask.new do |rd|
16
16
  rd.main = "README.rdoc"
17
17
  rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
18
- rd.title = 'Your application title'
18
+ rd.title = 'na'
19
19
  end
20
20
 
21
21
  spec = eval(File.read('na.gemspec'))
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
 
@@ -431,18 +431,18 @@ module NA
431
431
 
432
432
  unless a.tags.empty?
433
433
  tags = []
434
- a.tags.each do |k, v|
435
- next if k =~ /^(due|flagged|done)$/
434
+ a.tags.each do |key, val|
435
+ next if key =~ /^(due|flagged|done)$/
436
436
 
437
- tag = k
438
- tag += "-#{v}" unless v.nil? || v.empty?
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")}" if !a.note.empty?
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
- actions.each do |action|
474
- if parent_files.key?(action.file)
475
- parent_files[action.file].push(action)
476
- else
477
- parent_files[action.file] = [action]
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
- out = []
482
- parent_files.each do |file, actions|
483
- projects = project_hierarchy(actions)
484
- out.push("#{file.sub(%r{^./}, '').shorten_path}:")
485
- out.concat(output_children(projects, 0))
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/string.rb CHANGED
@@ -35,7 +35,7 @@ class ::String
35
35
  end
36
36
 
37
37
  def project
38
- m = match(/^([ \t]*)([^\-][^@()]+?): *(@\S+ *)*$/)
38
+ m = match(/^([ \t]*)([^\-][^@:]*?): *(@\S+ *)*$/)
39
39
  m ? m[2] : nil
40
40
  end
41
41
 
data/lib/na/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Na
2
- VERSION = '1.2.18'
2
+ VERSION = '1.2.20'
3
3
  end
data/scripts/fixreadme.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  current_ver = `rake cver`
5
- src = 'src/README.md'
5
+ src = 'src/_README.md'
6
6
  dest = 'README.md'
7
7
 
8
8
  readme = IO.read(src).force_encoding('ASCII-8BIT').encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
@@ -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.17<!--END VER-->.
12
+ The current version of `na` is <!--VER-->1.2.19<!--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.18
4
+ version: 1.2.20
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-01-17 00:00:00.000000000 Z
11
+ date: 2023-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -219,7 +219,7 @@ files:
219
219
  - na.gemspec
220
220
  - na.rdoc
221
221
  - scripts/fixreadme.rb
222
- - src/README.md
222
+ - src/_README.md
223
223
  homepage: https://brettterpstra.com/projects/na/
224
224
  licenses:
225
225
  - MIT