na 1.2.15 → 1.2.16

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: 4d2ce71562668eb958d8056e6f226329839fe872575eb0f6dba5220aedbc09a5
4
- data.tar.gz: c1461870c50b6665a0269c7be2e05130cf8c94ab1fd8a929b4566c391b81a8e4
3
+ metadata.gz: 8d8da07f9b65304b26e03aeeb38af43e72fb378eb016efdee8eac61b9c992609
4
+ data.tar.gz: 62710fb19fec1f6ddf4e06c4cc12b3f5c3d7a8fd646dc792593d72a4c01065df
5
5
  SHA512:
6
- metadata.gz: f5fe87068b1ad84b747f35e255ddd64687c90733b9526e41c258e13557ccc9396b8025ef42acf3fd90a7facb6049a4907f099c36f8ef4977ac479aab5d451a07
7
- data.tar.gz: 702e69f47f8baf069fe398ac3daac5615c56095377df31b91e93edb6a94dae8682ab4fb2574c8f57b419a6ddf2fc61938def7c598990c60aeb722ccb7af9f97b
6
+ metadata.gz: e7dee3f47d88e9dcdea8d10f585685452124de43e32b1279a057167bc86a96fc709c662064951c5690ff5b7c7f685b77268b29931e8cd5cd562220e95df96847
7
+ data.tar.gz: 794c1a1e458d61326165e56a21de4e2792a7a0247404fc584c7a6ecebea029892fd988ea602039a48006c5f5aeed7e883f8bff114346d01c5df1b5eb3a7e7d26
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
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
+
1
13
  ### 1.2.15
2
14
 
3
15
  2022-11-28 10:58
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- na (1.2.15)
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.15
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.15
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
 
@@ -330,12 +330,8 @@ module NA
330
330
  contents.slice!(action.line, action.note.count + 1)
331
331
  next if delete
332
332
 
333
- target_proj = action.project if target_proj.nil?
334
-
335
333
  projects = shift_index_after(projects, action.line, action.note.count + 1)
336
334
 
337
- target_proj = projects.select { |proj| proj.project =~ /^#{target_proj.project}$/ }.first
338
-
339
335
  action = process_action(action, priority: priority, finish: finish, add_tag: add_tag, remove_tag: remove_tag)
340
336
 
341
337
  target_proj = if target_proj
@@ -440,6 +436,32 @@ module NA
440
436
  puts(actions.map { |action| action.pretty(template: { output: template }, regexes: regexes, notes: notes) })
441
437
  end
442
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
+
443
465
  ##
444
466
  ## Read a todo file and create a list of actions
445
467
  ##
data/lib/na/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Na
2
- VERSION = '1.2.15'
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.14<!--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.15
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-28 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