na 1.2.14 → 1.2.16

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: da1fc18252895707dfb04a598aca5ac535b4c65959b564d11d56497796a09249
4
- data.tar.gz: 7d483b22ddd0015b02bbea54c5026ba11b3cfc58597d790eed5d0902bbb285ba
3
+ metadata.gz: 8d8da07f9b65304b26e03aeeb38af43e72fb378eb016efdee8eac61b9c992609
4
+ data.tar.gz: 62710fb19fec1f6ddf4e06c4cc12b3f5c3d7a8fd646dc792593d72a4c01065df
5
5
  SHA512:
6
- metadata.gz: bfde6ccd9c352ef8932df8937218701b54db37994d1d0642323b4bc69a5bb6bf566588a9a4908a37312dc7b9787547427bf68609b124dfe752c3acec5b807bb8
7
- data.tar.gz: 87ce30671ba3cc2bf415744df17df187e834966db481c7e5b2310eb873315a68061541f9342c0578f51d8d93f8a0accdde6df6030393d1d28aaacbfc33ac170e
6
+ metadata.gz: e7dee3f47d88e9dcdea8d10f585685452124de43e32b1279a057167bc86a96fc709c662064951c5690ff5b7c7f685b77268b29931e8cd5cd562220e95df96847
7
+ data.tar.gz: 794c1a1e458d61326165e56a21de4e2792a7a0247404fc584c7a6ecebea029892fd988ea602039a48006c5f5aeed7e883f8bff114346d01c5df1b5eb3a7e7d26
data/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ### 1.2.16
2
+
3
+ 2023-01-17 10:13
4
+
5
+ #### NEW
6
+
7
+ - `na next --nest` will output a TaskPaper format list of actions grouped under their respective files with the filename as the containing project
8
+
9
+ #### FIXED
10
+
11
+ - Better solution to target_proj nil error
12
+
13
+ ### 1.2.15
14
+
15
+ 2022-11-28 10:58
16
+
17
+ #### FIXED
18
+
19
+ - `na update` error when not moving project
20
+
1
21
  ### 1.2.14
2
22
 
3
23
  2022-11-12 10:57
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- na (1.2.14)
4
+ na (1.2.16)
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.14
12
+ The current version of `na` is 1.2.16
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.14
80
+ 1.2.16
81
81
 
82
82
  GLOBAL OPTIONS
83
83
  -a, --[no-]add - Add a next action (deprecated, for backwards compatibility)
@@ -272,6 +272,7 @@ COMMAND OPTIONS
272
272
  --[no-]done - Include @done actions
273
273
  --[no-]exact - Search query is exact text match (not tokens)
274
274
  --in, --todo=TODO_FILE - Display matches from a known todo file (may be used more than once, default: none)
275
+ --[no-]nest - Output actions nested by file
275
276
  --[no-]notes - Include notes in output
276
277
  --proj, --project=PROJECT[/SUBPROJECT] - Show actions from a specific project (default: none)
277
278
  --[no-]regex - Search query is regular expression
@@ -376,6 +377,7 @@ COMMAND OPTIONS
376
377
  --[no-]done - Include @done actions
377
378
  --[no-]exact - Search query is exact text match (not tokens)
378
379
  --in, --todo=TODO_FILE - Display matches from a known todo file (may be used more than once, default: none)
380
+ --[no-]nest - Output actions nested by file
379
381
  --[no-]notes - Include notes in output
380
382
  --proj, --project=PROJECT[/SUBPROJECT] - Show actions from a specific project (default: none)
381
383
  --[no-]regex - Search query is regular expression
data/bin/na CHANGED
@@ -115,6 +115,9 @@ class App
115
115
  c.desc 'Include @done actions'
116
116
  c.switch %i[done]
117
117
 
118
+ c.desc 'Output actions nested by file'
119
+ c.switch %[nest]
120
+
118
121
  c.action do |global_options, options, args|
119
122
  if global_options[:add]
120
123
  cmd = ['add']
@@ -196,7 +199,11 @@ class App
196
199
  project: options[:project],
197
200
  require_na: require_na)
198
201
 
199
- NA.output_actions(actions, depth, files: files, notes: options[:notes])
202
+ if options[:nest]
203
+ NA.output_actions_by_file(actions, depth, files: files, notes: options[:notes])
204
+ else
205
+ NA.output_actions(actions, depth, files: files, notes: options[:notes])
206
+ end
200
207
  end
201
208
  end
202
209
 
@@ -332,8 +332,6 @@ module NA
332
332
 
333
333
  projects = shift_index_after(projects, action.line, action.note.count + 1)
334
334
 
335
- target_proj = projects.select { |proj| proj.project =~ /^#{target_proj.project}$/ }.first
336
-
337
335
  action = process_action(action, priority: priority, finish: finish, add_tag: add_tag, remove_tag: remove_tag)
338
336
 
339
337
  target_proj = if target_proj
@@ -438,6 +436,32 @@ module NA
438
436
  puts(actions.map { |action| action.pretty(template: { output: template }, regexes: regexes, notes: notes) })
439
437
  end
440
438
 
439
+ def output_actions_by_file(actions, depth, files: nil, regexes: [], notes: false)
440
+ return if files.nil?
441
+
442
+ template = '%parent%action'
443
+
444
+ parent_files = {}
445
+
446
+ actions.each do |action|
447
+ if parent_files.key?(action.file)
448
+ parent_files[action.file].push(action)
449
+ else
450
+ parent_files[action.file] = [action]
451
+ end
452
+ end
453
+
454
+ out = []
455
+ parent_files.each do |k, v|
456
+ out.push("#{k.sub(%r{^\./}, '')}:")
457
+ v.each do |a|
458
+ out.push(" - [#{a.parent.join('/')}] #{a.action}")
459
+ end
460
+ end
461
+
462
+ puts out.join("\n")
463
+ end
464
+
441
465
  ##
442
466
  ## Read a todo file and create a list of actions
443
467
  ##
data/lib/na/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Na
2
- VERSION = '1.2.14'
2
+ VERSION = '1.2.16'
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.13<!--END VER-->.
12
+ The current version of `na` is <!--VER-->1.2.15<!--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.14
4
+ version: 1.2.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-12 00:00:00.000000000 Z
11
+ date: 2023-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake