na 1.2.70 → 1.2.72

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: 56f715c29577f9b9e9d757574336719a2e288ccf3b115094e985bacb06e65fb8
4
- data.tar.gz: d2fdb11e46d322f9efe4b3038ec2becd9a3becc51b8d7c4ff44ae028cd8912ac
3
+ metadata.gz: feb11772caf2e24a24d6cc0ee5dbd2c56873ac0b45750683cec8b24ac70e07f0
4
+ data.tar.gz: f0225c850ee3ee2cc3358e400afd7b85eea969c0a085c1a1961444596aff762b
5
5
  SHA512:
6
- metadata.gz: 2cad1158ba4c4477a88a949856bace92e261c435675ba56491e790a189299525168f1999fee5ecee7025f49dc54693bce3347034ea36782632dd3ddfb86835de
7
- data.tar.gz: ea2f842e4cec6a2040bf730dfc60d683d15638b6db71496ab5e4b3b59bf566183a982d30ab65167e41a9eb6e0002c2061c135ebb22de0edd668b69e5575bb362
6
+ metadata.gz: c8195645b8793fb6f8bfe48d91f387058b24d83431e71959c5a381ea9663bc7429a2b71bac8591cc35cdc9bd75e0d123b9bcdc52d0ff9462babff5c2cda15e31
7
+ data.tar.gz: 7738332bf944fb5c9e67d48b91495ca92df2c7dc28673d290e4713258c8c89c6652649c2353bca7e397e954a6dfafed548a5ee417f574d60e7fbb258cec2902a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ ### 1.2.72
2
+
3
+ 2025-03-15 08:13
4
+
5
+ #### NEW
6
+
7
+ - --no_file option for `na next` to display without filename (instead of editing templates)
8
+
9
+ #### IMPROVED
10
+
11
+ - --priority in `na next` and `na add` accepts "h", "m", or "l" to equal 5, 3, 1
12
+
13
+ #### FIXED
14
+
15
+ - - - - @fixed Matching parenthetical notes at the end of a task entry was too greedy
16
+ - - - - - @fixed Matching parenthetical notes at the end of a task entry was too greedy - Error in concat for line notes
17
+ - - - - - @fixed Matching parenthetical notes at the end of a task entry was too greedy
18
+ - - - - - - @fixed Matching parenthetical notes at the end of a task entry was too greedy - Error in concat for line notes
19
+
20
+ ### 1.2.71
21
+
22
+ 2024-09-28 11:12
23
+
24
+ #### FIXED
25
+
26
+ - - - @fixed Matching parenthetical notes at the end of a task entry was too greedy
27
+ - - - - @fixed Matching parenthetical notes at the end of a task entry was too greedy
28
+ - Error in concat for line notes
29
+
1
30
  ### 1.2.70
2
31
 
3
32
  2024-09-28 11:10
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- na (1.2.70)
4
+ na (1.2.72)
5
5
  chronic (~> 0.10, >= 0.10.2)
6
6
  gli (~> 2.21.0)
7
7
  mdless (~> 1.0, >= 1.0.32)
@@ -12,12 +12,37 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
+ ast (2.4.2)
15
16
  chronic (0.10.2)
16
- gli (2.21.1)
17
+ gli (2.21.5)
18
+ json (2.10.2)
19
+ language_server-protocol (3.17.0.4)
20
+ lint_roller (1.1.0)
17
21
  mdless (1.0.37)
18
22
  minitest (5.20.0)
23
+ parallel (1.26.3)
24
+ parser (3.3.7.1)
25
+ ast (~> 2.4.1)
26
+ racc
27
+ racc (1.8.1)
28
+ rainbow (3.1.1)
19
29
  rake (0.9.6)
20
30
  rdoc (4.3.0)
31
+ regexp_parser (2.10.0)
32
+ rubocop (1.74.0)
33
+ json (~> 2.3)
34
+ language_server-protocol (~> 3.17.0.2)
35
+ lint_roller (~> 1.1.0)
36
+ parallel (~> 1.10)
37
+ parser (>= 3.3.0.2)
38
+ rainbow (>= 2.2.2, < 4.0)
39
+ regexp_parser (>= 2.9.3, < 3.0)
40
+ rubocop-ast (>= 1.38.0, < 2.0)
41
+ ruby-progressbar (~> 1.7)
42
+ unicode-display_width (>= 2.4.0, < 4.0)
43
+ rubocop-ast (1.38.1)
44
+ parser (>= 3.3.1.0)
45
+ ruby-progressbar (1.13.0)
21
46
  tty-cursor (0.7.1)
22
47
  tty-reader (0.9.0)
23
48
  tty-cursor (~> 0.7)
@@ -25,12 +50,16 @@ GEM
25
50
  wisper (~> 2.0)
26
51
  tty-screen (0.8.2)
27
52
  tty-which (0.5.0)
53
+ unicode-display_width (3.1.4)
54
+ unicode-emoji (~> 4.0, >= 4.0.4)
55
+ unicode-emoji (4.0.4)
28
56
  wisper (2.0.1)
29
57
  yard (0.9.34)
30
58
 
31
59
  PLATFORMS
32
60
  arm64-darwin-20
33
61
  arm64-darwin-21
62
+ arm64-darwin-24
34
63
  x86_64-darwin-20
35
64
 
36
65
  DEPENDENCIES
@@ -38,7 +67,8 @@ DEPENDENCIES
38
67
  na!
39
68
  rake (~> 0.9.2)
40
69
  rdoc (~> 4.3)
70
+ rubocop (~> 1.74)
41
71
  yard (~> 0.9, >= 0.9.26)
42
72
 
43
73
  BUNDLED WITH
44
- 2.2.29
74
+ 2.6.6
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.70.
12
+ The current version of `na` is 1.2.72.
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
 
@@ -76,14 +76,14 @@ SYNOPSIS
76
76
  na [global options] command [command options] [arguments...]
77
77
 
78
78
  VERSION
79
- 1.2.70
79
+ 1.2.72
80
80
 
81
81
  GLOBAL OPTIONS
82
82
  -a, --add - Add a next action (deprecated, for backwards compatibility)
83
83
  --add_at=POSITION - Add all new/moved entries at [s]tart or [e]nd of target project (default: start)
84
84
  --[no-]color - Colorize output (default: enabled)
85
85
  --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)
86
+ -d, --depth=DEPTH - Recurse to depth (default: 1)
87
87
  --[no-]debug - Display verbose output
88
88
  --ext=EXT - File extension to consider a todo file (default: taskpaper)
89
89
  -f, --file=PATH - Use a single file as global todo, use initconfig to make permanent (default: none)
@@ -154,7 +154,7 @@ COMMAND OPTIONS
154
154
  --finish, --done - Mark task as @done with date
155
155
  --in, --todo=TODO_FILE - Add to a known todo file, partial matches allowed (default: none)
156
156
  -n, --note - Prompt for additional notes. STDIN input (piped) will be treated as a note if present.
157
- -p, --priority=PRIO - Add a priority level 1-5 (default: 0)
157
+ -p, --priority=PRIO - Add a priority level 1-5 or h, m, l (default: 0)
158
158
  -t, --tag=TAG - Use a tag other than the default next action tag (default: none)
159
159
  --to, --project, --proj=PROJECT - Add action to specific project (default: Inbox)
160
160
  -x - Don't add next action tag to new entry
@@ -335,6 +335,7 @@ COMMAND OPTIONS
335
335
  --file=TODO_FILE - Display matches from specific todo file ([relative] path) (default: none)
336
336
  --in, --todo=TODO - Display matches from a known todo file anywhere in history (short name) (may be used more than once, default: none)
337
337
  --nest - Output actions nested by file
338
+ --no_file - No filename in output
338
339
  --[no-]notes - Include notes in output
339
340
  --omnifocus - Output actions nested by file and project
340
341
  -p, --prio, --priority=PRIORITY - Match actions with priority, allows <>= comparison (may be used more than once, default: none)
@@ -452,6 +453,7 @@ COMMAND OPTIONS
452
453
  --file=TODO_FILE - Display matches from specific todo file ([relative] path) (default: none)
453
454
  --in, --todo=TODO - Display matches from a known todo file anywhere in history (short name) (may be used more than once, default: none)
454
455
  --nest - Output actions nested by file
456
+ --no_file - No filename in output
455
457
  --[no-]notes - Include notes in output
456
458
  --omnifocus - Output actions nested by file and project
457
459
  -p, --prio, --priority=PRIORITY - Match actions with priority, allows <>= comparison (may be used more than once, default: none)
data/bin/commands/add.rb CHANGED
@@ -20,9 +20,9 @@ class App
20
20
  c.desc "Prompt for additional notes. STDIN input (piped) will be treated as a note if present."
21
21
  c.switch %i[n note], negatable: false
22
22
 
23
- c.desc "Add a priority level 1-5"
23
+ c.desc "Add a priority level 1-5 or h, m, l"
24
24
  c.arg_name "PRIO"
25
- c.flag %i[p priority], must_match: /[1-5]/, type: :integer, default_value: 0
25
+ c.flag %i[p priority], must_match: /[1-5hml]/, default_value: 0
26
26
 
27
27
  c.desc "Add action to specific project"
28
28
  c.arg_name "PROJECT"
@@ -59,6 +59,15 @@ class App
59
59
  reader = TTY::Reader.new
60
60
  append = options[:at] ? options[:at] =~ /^[ae]/i : global_options[:add_at] =~ /^[ae]/
61
61
 
62
+ priority = options[:priority]
63
+ if priority =~ /^[1-5]$/
64
+ priority = priority.to_i
65
+ elsif priority =~ /^[hml]$/
66
+ priority = NA.priority_map[priority]
67
+ else
68
+ priority = 0
69
+ end
70
+
62
71
  if NA.global_file
63
72
  target = File.expand_path(NA.global_file)
64
73
  unless File.exist?(target)
@@ -133,14 +142,14 @@ class App
133
142
  end
134
143
 
135
144
  note_rx = /^(.+) \(([^)]+)\)$/
136
- split_note = if action =~ note_rx
137
- n = Regexp.last_match(2)
138
- action.sub!(note_rx, '\1').strip!
139
- n
140
- end
145
+ split_note = if action =~ note_rx
146
+ n = Regexp.last_match(2)
147
+ action.sub!(note_rx, '\1').strip!
148
+ n
149
+ end
141
150
 
142
- if options[:priority]&.to_i&.positive?
143
- action = "#{action.gsub(/@priority\(\d+\)/, "")} @priority(#{options[:priority]})"
151
+ if priority&.to_i&.positive?
152
+ action = "#{action.gsub(/@priority\(\d+\)/, "")} @priority(#{priority})"
144
153
  end
145
154
 
146
155
  na_tag = NA.na_tag
@@ -170,7 +179,7 @@ split_note = if action =~ note_rx
170
179
 
171
180
  note = stdin_note.empty? ? [] : stdin_note
172
181
  note.<< split_note unless split_note.nil?
173
- note << line_note unless line_note.nil?
182
+ note.concat(line_note) unless line_note.nil?
174
183
 
175
184
  NA.add_action(target, options[:project], action, note, finish: options[:finish], append: append)
176
185
  end
data/bin/commands/next.rb CHANGED
@@ -68,6 +68,9 @@ class App
68
68
  c.desc 'Output actions nested by file'
69
69
  c.switch %i[nest], negatable: false
70
70
 
71
+ c.desc 'No filename in output'
72
+ c.switch %i[no_file], negatable: false
73
+
71
74
  c.desc 'Output actions nested by file and project'
72
75
  c.switch %i[omnifocus], negatable: false
73
76
 
@@ -76,6 +79,7 @@ class App
76
79
  c.flag %i[save]
77
80
 
78
81
  c.action do |global_options, options, args|
82
+ # For backward compatibility with na -a
79
83
  if global_options[:add]
80
84
  cmd = ['add']
81
85
  cmd.push('--note') if global_options[:note]
@@ -101,11 +105,17 @@ class App
101
105
  if options[:exact] || options[:regex]
102
106
  search = options[:search].join(' ')
103
107
  else
108
+ # This regex matches the following:
109
+ # @tag(value)
110
+ # @tag=value (or > < >= <=)
111
+ # @tag=~value
112
+ # @tag ^= value (or *=, $=)
104
113
  rx = [
105
114
  '(?<=\A|[ ,])(?<req>[+!-])?@(?<tag>[^ *=<>$~\^,@(]+)',
106
115
  '(?:\((?<value>.*?)\)| *(?<op>=~|[=<>~]{1,2}|[*$\^]=) *',
107
116
  '(?<val>.*?(?=\Z|[,@])))?'
108
117
  ].join('')
118
+ # convert tag(value) to tag=value
109
119
  search = options[:search].join(' ').gsub(Regexp.new(rx)) do
110
120
  m = Regexp.last_match
111
121
  string = if m['value']
@@ -123,6 +133,18 @@ class App
123
133
  if options[:priority].count.positive?
124
134
  prios = options[:priority].join(',').split(/,/)
125
135
  options[:or] = true if prios.count > 1
136
+ prios.map! do |p|
137
+ p.sub(/([hml])$/) do
138
+ case Regexp.last_match[1]
139
+ when 'h'
140
+ NA.priority_map['h']
141
+ when 'm'
142
+ NA.priority_map['m']
143
+ when 'l'
144
+ NA.priority_map['l']
145
+ end
146
+ end
147
+ end
126
148
  prios.each do |p|
127
149
  options[:tagged] << if p =~ /^[<>=]{1,2}/
128
150
  "priority#{p}"
@@ -212,7 +234,8 @@ class App
212
234
  files: todo.files,
213
235
  nest: options[:nest],
214
236
  nest_projects: options[:omnifocus],
215
- notes: options[:notes])
237
+ notes: options[:notes],
238
+ no_files: options[:no_file])
216
239
  end
217
240
  end
218
241
  end
data/lib/na/actions.rb CHANGED
@@ -16,11 +16,12 @@ module NA
16
16
  ## @param files [Array] The files actions originally came from
17
17
  ## @param regexes [Array] The regexes used to gather actions
18
18
  ##
19
- def output(depth, files: nil, regexes: [], notes: false, nest: false, nest_projects: false)
19
+ def output(depth, files: nil, regexes: [], notes: false, nest: false, nest_projects: false, no_files: false)
20
20
  return if files.nil?
21
21
 
22
22
  if nest
23
23
  template = NA.theme[:templates][:default]
24
+ template = NA.theme[:templates][:no_file] if no_files
24
25
 
25
26
  parent_files = {}
26
27
  out = []
@@ -41,6 +42,7 @@ module NA
41
42
  end
42
43
  else
43
44
  template = NA.theme[:templates][:default]
45
+ template = NA.theme[:templates][:no_file] if no_files
44
46
 
45
47
  each do |action|
46
48
  if parent_files.key?(action.file)
@@ -60,7 +62,10 @@ module NA
60
62
  end
61
63
  NA::Pager.page out.join("\n")
62
64
  else
63
- template = if files.count.positive?
65
+ template =
66
+ if no_files
67
+ NA.theme[:templates][:no_file]
68
+ elsif files.count.positive?
64
69
  if files.count == 1
65
70
  NA.theme[:templates][:single_file]
66
71
  else
data/lib/na/hash.rb CHANGED
@@ -35,4 +35,9 @@ class ::Hash
35
35
  def deep_thaw!
36
36
  replace deep_thaw
37
37
  end
38
+
39
+ def deep_merge(second)
40
+ merger = proc { |_, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : Array === v1 && Array === v2 ? v1 | v2 : [:undefined, nil, :nil].include?(v2) ? v1 : v2 }
41
+ merge(second.to_h, &merger)
42
+ end
38
43
  end
@@ -30,6 +30,14 @@ module NA
30
30
  Process.exit exit_code if exit_code
31
31
  end
32
32
 
33
+ def priority_map
34
+ {
35
+ 'h' => 5,
36
+ 'm' => 3,
37
+ 'l' => 1
38
+ }
39
+ end
40
+
33
41
  ##
34
42
  ## Display and read a Yes/No prompt
35
43
  ##
data/lib/na/theme.rb CHANGED
@@ -46,7 +46,8 @@ module NA
46
46
  output: '%filename%parents| %action',
47
47
  default: '%parent%action',
48
48
  single_file: '%parent%action',
49
- multi_file: '%filename%parent%action'
49
+ multi_file: '%filename%parent%action',
50
+ no_file: '%parent%action'
50
51
  }
51
52
  }
52
53
 
@@ -57,7 +58,7 @@ module NA
57
58
  else
58
59
  {}
59
60
  end
60
- theme = default_template.merge(theme)
61
+ theme = default_template.deep_merge(theme)
61
62
 
62
63
  File.open(theme_file, 'w') do |f|
63
64
  f.puts template_help.comment
data/lib/na/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Na
2
- VERSION = '1.2.70'
2
+ VERSION = '1.2.72'
3
3
  end
data/na.gemspec CHANGED
@@ -1,5 +1,6 @@
1
1
  # Ensure we require the local version and not one we might have installed already
2
- require File.join([File.dirname(__FILE__),'lib','na','version.rb'])
2
+ require './lib/na/version.rb'
3
+
3
4
  spec = Gem::Specification.new do |s|
4
5
  s.name = 'na'
5
6
  s.version = Na::VERSION
@@ -14,9 +15,7 @@ spec = Gem::Specification.new do |s|
14
15
  'Add prompt hooks to display your next actions automatically when cd\'ing into a directory.'
15
16
  ].join(' ')
16
17
  s.license = 'MIT'
17
- s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
18
- `git ls-files -z`.split("\x0").reject { |f| f.strip =~ %r{^((test|spec|features)/|\.git|buildnotes|.*\.taskpaper)} }
19
- end
18
+ s.files =`git ls-files -z`.split("\x0").reject { |f| f.strip =~ %r{^((test|spec|features)/|\.git|buildnotes|.*\.taskpaper)} }
20
19
  s.require_paths << 'lib'
21
20
  s.extra_rdoc_files = ['README.md','na.rdoc']
22
21
  s.rdoc_options << '--title' << 'na' << '--main' << 'README.md' << '--markup' << 'markdown'
@@ -26,6 +25,7 @@ spec = Gem::Specification.new do |s|
26
25
  s.add_development_dependency('rdoc', '~> 4.3')
27
26
  s.add_development_dependency('minitest', '~> 5.14')
28
27
  s.add_development_dependency('yard', '~> 0.9', '>= 0.9.26')
28
+ s.add_development_dependency('rubocop', '~> 1.74')
29
29
  s.add_runtime_dependency('gli','~> 2.21.0')
30
30
  s.add_runtime_dependency('tty-reader', '~> 0.9', '>= 0.9.0')
31
31
  s.add_runtime_dependency('tty-screen', '~> 0.8', '>= 0.8.1')
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.68<!--END VER-->.
12
+ The current version of `na` is <!--VER-->1.2.71<!--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,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: na
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.70
4
+ version: 1.2.72
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-09-28 00:00:00.000000000 Z
10
+ date: 2025-03-15 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rake
@@ -72,6 +71,20 @@ dependencies:
72
71
  - - ">="
73
72
  - !ruby/object:Gem::Version
74
73
  version: 0.9.26
74
+ - !ruby/object:Gem::Dependency
75
+ name: rubocop
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '1.74'
81
+ type: :development
82
+ prerelease: false
83
+ version_requirements: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '1.74'
75
88
  - !ruby/object:Gem::Dependency
76
89
  name: gli
77
90
  requirement: !ruby/object:Gem::Requirement
@@ -254,7 +267,6 @@ homepage: https://brettterpstra.com/projects/na/
254
267
  licenses:
255
268
  - MIT
256
269
  metadata: {}
257
- post_install_message:
258
270
  rdoc_options:
259
271
  - "--title"
260
272
  - na
@@ -276,8 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
276
288
  - !ruby/object:Gem::Version
277
289
  version: '0'
278
290
  requirements: []
279
- rubygems_version: 3.5.14
280
- signing_key:
291
+ rubygems_version: 3.6.5
281
292
  specification_version: 4
282
293
  summary: A command line tool for adding and listing project todos
283
294
  test_files: []