na 1.2.7 → 1.2.9
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 +4 -4
- data/CHANGELOG.md +21 -0
- data/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/bin/na +1 -1
- data/lib/na/next_action.rb +38 -21
- data/lib/na/project.rb +6 -4
- data/lib/na/version.rb +1 -1
- data/src/README.md +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1d1d2b4c66a795f01e07e0df15418b4c3cac378e05d9840ba2e51b58bf48a14
|
4
|
+
data.tar.gz: 1486f0da182d56b54e15fc5deb39aa4ce6571b276d112cf7af4583ad0f3f4563
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7eada283ae9fb6af012be91b2c0d9366efb88ac8d6b28057400b4ecbe6c4d66fdb37e11b7ee7c8bb68797ef27f016ab6352e5c249a10c6195b5731c8308f0a9
|
7
|
+
data.tar.gz: 7cadc34d3445cda5f47cbd57a3d68120031bba9f9e8307ceb1ea8df7419198c8c77782517f47d16beaa0f35eea3cc0df29b6895c9afa612dd2573c0260809728
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
### 1.2.9
|
2
|
+
|
3
|
+
2022-10-29 10:50
|
4
|
+
|
5
|
+
#### FIXED
|
6
|
+
|
7
|
+
- Na next with a todo search wasn't requiring a match
|
8
|
+
|
9
|
+
### 1.2.8
|
10
|
+
|
11
|
+
2022-10-28 11:52
|
12
|
+
|
13
|
+
#### IMPROVED
|
14
|
+
|
15
|
+
- Empty lines in notes end a task in the parser
|
16
|
+
- Moving a task to the end of a project respects line breaks
|
17
|
+
|
18
|
+
#### FIXED
|
19
|
+
|
20
|
+
- Moving action within same project to end not parsing correctly
|
21
|
+
|
1
22
|
### 1.2.7
|
2
23
|
|
3
24
|
2022-10-28 07:29
|
data/Gemfile.lock
CHANGED
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.
|
12
|
+
The current version of `na` is 1.2.9
|
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,11 +77,11 @@ SYNOPSIS
|
|
77
77
|
na [global options] command [command options] [arguments...]
|
78
78
|
|
79
79
|
VERSION
|
80
|
-
1.2.
|
80
|
+
1.2.9
|
81
81
|
|
82
82
|
GLOBAL OPTIONS
|
83
83
|
-a, --[no-]add - Add a next action (deprecated, for backwards compatibility)
|
84
|
-
--add_at=POSITION - Add all new/moved entries at [s]tart or [e]nd of target project (default:
|
84
|
+
--add_at=POSITION - Add all new/moved entries at [s]tart or [e]nd of target project (default: start)
|
85
85
|
--cwd_as=TYPE - Use current working directory as [p]roject, [t]ag, or [n]one (default: none)
|
86
86
|
-d, --depth=DEPTH - Recurse to depth (default: 3)
|
87
87
|
--[no-]debug - Display verbose output
|
data/bin/na
CHANGED
data/lib/na/next_action.rb
CHANGED
@@ -127,7 +127,9 @@ module NA
|
|
127
127
|
|
128
128
|
def shift_index_after(projects, idx, length = 1)
|
129
129
|
projects.map do |proj|
|
130
|
-
proj.line = proj.line
|
130
|
+
proj.line = proj.line - length if proj.line > idx
|
131
|
+
proj.last_line = proj.last_line - length if proj.last_line > idx
|
132
|
+
|
131
133
|
proj
|
132
134
|
end
|
133
135
|
end
|
@@ -196,7 +198,7 @@ module NA
|
|
196
198
|
content = "#{input.join("\n")}\n#{content}"
|
197
199
|
end
|
198
200
|
|
199
|
-
new_project = NA::Project.new(path.map(&:cap_first).join(':'), indent - 1, input.count - 1)
|
201
|
+
new_project = NA::Project.new(path.map(&:cap_first).join(':'), indent - 1, input.count - 1, input.count - 1)
|
200
202
|
else
|
201
203
|
line = final_match.line + 1
|
202
204
|
indent = final_match.indent + 1
|
@@ -206,7 +208,7 @@ module NA
|
|
206
208
|
indent += 1
|
207
209
|
end
|
208
210
|
content = content.split("\n").insert(line, input.join("\n")).join("\n")
|
209
|
-
new_project = NA::Project.new(path.map(&:cap_first).join(':'), indent - 1, line + input.count - 1)
|
211
|
+
new_project = NA::Project.new(path.map(&:cap_first).join(':'), indent - 1, line + input.count - 1, line + input.count - 1)
|
210
212
|
end
|
211
213
|
|
212
214
|
File.open(target, 'w') do |f|
|
@@ -263,6 +265,7 @@ module NA
|
|
263
265
|
target_proj = nil
|
264
266
|
|
265
267
|
if project
|
268
|
+
project.sub!(/:$/, '')
|
266
269
|
target_proj = projects.select { |pr| pr.project =~ /#{project.gsub(/:/, '.*?:.*?')}/i }.first
|
267
270
|
if target_proj.nil?
|
268
271
|
res = NA.yn(NA::Color.template("{y}Project {bw}#{project}{xy} doesn't exist, add it"), default: true)
|
@@ -307,19 +310,18 @@ module NA
|
|
307
310
|
break
|
308
311
|
end
|
309
312
|
end
|
310
|
-
|
311
313
|
target_line = if this_idx == projects.length - 1
|
312
314
|
contents.count
|
313
315
|
else
|
314
|
-
projects[this_idx
|
316
|
+
projects[this_idx].last_line + 1
|
315
317
|
end
|
316
318
|
else
|
317
|
-
target_line = target_proj.line
|
319
|
+
target_line = target_proj.line + 1
|
318
320
|
end
|
319
321
|
|
320
322
|
contents.insert(target_line, "#{indent}\t- #{action.action}#{note}")
|
321
323
|
else
|
322
|
-
|
324
|
+
_, actions = find_actions(target, search, tagged, done: done, all: all)
|
323
325
|
|
324
326
|
return if actions.nil?
|
325
327
|
|
@@ -329,6 +331,8 @@ module NA
|
|
329
331
|
|
330
332
|
projects = shift_index_after(projects, action.line, action.note.count + 1)
|
331
333
|
|
334
|
+
target_proj = projects.select { |proj| proj.project =~ /^#{target_proj.project}$/ }.first
|
335
|
+
|
332
336
|
action = process_action(action, priority: priority, finish: finish, add_tag: add_tag, remove_tag: remove_tag)
|
333
337
|
|
334
338
|
target_proj = if target_proj
|
@@ -347,14 +351,21 @@ module NA
|
|
347
351
|
note = note.empty? ? '' : "\n#{indent}\t\t#{note.join("\n#{indent}\t\t").strip}"
|
348
352
|
|
349
353
|
if append
|
350
|
-
this_idx =
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
354
|
+
this_idx = 0
|
355
|
+
projects.each_with_index do |proj, idx|
|
356
|
+
if proj.line == target_proj.line
|
357
|
+
this_idx = idx
|
358
|
+
break
|
359
|
+
end
|
355
360
|
end
|
361
|
+
|
362
|
+
target_line = if this_idx == projects.length - 1
|
363
|
+
contents.count
|
364
|
+
else
|
365
|
+
projects[this_idx].last_line + 1
|
366
|
+
end
|
356
367
|
else
|
357
|
-
target_line = target_proj.line
|
368
|
+
target_line = target_proj.line + 1
|
358
369
|
end
|
359
370
|
|
360
371
|
contents.insert(target_line, "#{indent}\t- #{action.action}#{note}")
|
@@ -497,6 +508,7 @@ module NA
|
|
497
508
|
content = file.read_file
|
498
509
|
indent_level = 0
|
499
510
|
parent = []
|
511
|
+
last_line = 0
|
500
512
|
in_action = false
|
501
513
|
content.split("\n").each.with_index do |line, idx|
|
502
514
|
if line =~ /^([ \t]*)([^\-][^@()]+?): *(@\S+ *)*$/
|
@@ -513,20 +525,23 @@ module NA
|
|
513
525
|
parent.push(proj)
|
514
526
|
end
|
515
527
|
|
516
|
-
projects.push(NA::Project.new(parent.join(':'), indent, idx
|
528
|
+
projects.push(NA::Project.new(parent.join(':'), indent, idx, idx))
|
517
529
|
|
518
530
|
indent_level = indent
|
531
|
+
elsif line.strip =~ /^$/
|
532
|
+
in_action = false
|
519
533
|
elsif line =~ /^[ \t]*- /
|
520
534
|
in_action = false
|
521
|
-
# search_for_done = false
|
522
|
-
# optional_tag.each { |t| search_for_done = true if t[:tag] =~ /done/ }
|
523
|
-
next if line =~ /@done/ && !done
|
524
|
-
|
525
|
-
next if require_na && line !~ /@#{NA.na_tag}\b/
|
526
535
|
|
527
536
|
action = line.sub(/^[ \t]*- /, '')
|
528
537
|
new_action = NA::Action.new(file, File.basename(file, ".#{NA.extension}"), parent.dup, action, idx)
|
529
538
|
|
539
|
+
projects[-1].last_line = idx if projects.count.positive?
|
540
|
+
|
541
|
+
next if line =~ /@done/ && !done
|
542
|
+
|
543
|
+
next if require_na && line !~ /@#{NA.na_tag}\b/
|
544
|
+
|
530
545
|
has_search = !optional.empty? || !required.empty? || !negated.empty?
|
531
546
|
|
532
547
|
next if has_search && !new_action.search_match?(any: optional,
|
@@ -545,10 +560,12 @@ module NA
|
|
545
560
|
|
546
561
|
actions.push(new_action)
|
547
562
|
in_action = true
|
548
|
-
|
549
|
-
actions[-1].note.push(line.strip) if actions.count.positive?
|
563
|
+
elsif in_action
|
564
|
+
actions[-1].note.push(line.strip) if actions.count.positive?
|
565
|
+
projects[-1].last_line = idx if projects.count.positive?
|
550
566
|
end
|
551
567
|
end
|
568
|
+
projects = projects.dup
|
552
569
|
end
|
553
570
|
|
554
571
|
[files, actions, projects]
|
data/lib/na/project.rb
CHANGED
@@ -2,24 +2,26 @@
|
|
2
2
|
|
3
3
|
module NA
|
4
4
|
class Project < Hash
|
5
|
-
attr_accessor :project, :indent, :line
|
5
|
+
attr_accessor :project, :indent, :line, :last_line
|
6
6
|
|
7
|
-
def initialize(project, indent = 0, line = 0)
|
7
|
+
def initialize(project, indent = 0, line = 0, last_line = 0)
|
8
8
|
super()
|
9
9
|
@project = project
|
10
10
|
@indent = indent
|
11
11
|
@line = line
|
12
|
+
@last_line = last_line
|
12
13
|
end
|
13
14
|
|
14
15
|
def to_s
|
15
|
-
{ project: @project, indent: @indent, line: @line }.to_s
|
16
|
+
{ project: @project, indent: @indent, line: @line, last_line: @last_line }.to_s
|
16
17
|
end
|
17
18
|
|
18
19
|
def inspect
|
19
20
|
[
|
20
21
|
"@project: #{@project}",
|
21
22
|
"@indent: #{@indent}",
|
22
|
-
"@line: #{@line}"
|
23
|
+
"@line: #{@line}",
|
24
|
+
"@last_line: #{@last_line}"
|
23
25
|
].join(" ")
|
24
26
|
end
|
25
27
|
end
|
data/lib/na/version.rb
CHANGED
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.
|
12
|
+
The current version of `na` is <!--VER-->1.2.8<!--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.
|
4
|
+
version: 1.2.9
|
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-10-
|
11
|
+
date: 2022-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|