na 1.2.46 → 1.2.48
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/Gemfile.lock +1 -1
- data/README.md +6 -2
- data/bin/commands/archive.rb +8 -0
- data/bin/commands/complete.rb +6 -0
- data/bin/commands/update.rb +13 -0
- data/lib/na/action.rb +19 -8
- data/lib/na/actions.rb +1 -1
- data/lib/na/array.rb +7 -0
- data/lib/na/colors.rb +1 -1
- data/lib/na/next_action.rb +13 -0
- data/lib/na/version.rb +1 -1
- data/src/_README.md +1 -1
- metadata +2 -3
- data/test2.txt +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 979a9debf8199d1e1182caaefb4d412c03c66c0c9785fd1ac638af13d211686e
|
4
|
+
data.tar.gz: 16bdab2fa8d9f8c326351bcc4c92e29aa3fed23a1dc23acc2c72a22ca12ecd41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0b05629b092b7e49c3b4c606ddb236387b9acf5edc6219a446ccebfc6a8ced5ab17629e78b5fc327c0eb0a4ec3203221e7b3a4d661cfcba224d44ae3798d48e
|
7
|
+
data.tar.gz: 702cfbe213a0aa67a249284511754613cd447cea62580a14982c4ef253d5b710a70438c5b6f27008b9a4191b3f52f0f2b5fa80de3a373c28c201f5c1dd043b00
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
### 1.2.48
|
2
|
+
|
3
|
+
2023-09-08 10:19
|
4
|
+
|
5
|
+
#### FIXED
|
6
|
+
|
7
|
+
- Error when `na add --to PROJECT` was a project that didn't exist
|
8
|
+
|
9
|
+
### 1.2.47
|
10
|
+
|
11
|
+
2023-09-07 10:47
|
12
|
+
|
13
|
+
#### NEW
|
14
|
+
|
15
|
+
- `na update --search OLD_TEXT --replace NEW_TEXT` (added --replace)
|
16
|
+
|
17
|
+
#### IMPROVED
|
18
|
+
|
19
|
+
- When not showing notes, add an asterisk in the template note
|
20
|
+
- When showing notes, indent to the beginning of the action
|
21
|
+
|
1
22
|
### 1.2.46
|
2
23
|
|
3
24
|
2023-09-06 21:25
|
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.48
|
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.
|
80
|
+
1.2.48
|
81
81
|
|
82
82
|
GLOBAL OPTIONS
|
83
83
|
-a, --add - Add a next action (deprecated, for backwards compatibility)
|
@@ -503,7 +503,9 @@ COMMAND OPTIONS
|
|
503
503
|
-p, --priority=PRIO - Add/change a priority level 1-5 (default: 0)
|
504
504
|
--proj, --project=PROJECT[/SUBPROJECT] - Affect actions from a specific project (default: none)
|
505
505
|
-r, --remove=TAG - Remove a tag from the action, use multiple times or combine multiple tags with a comma, wildcards (* and ?) allowed (may be used more than once, default: none)
|
506
|
+
--replace=TEXT - Use with --find to find and replace with new text. Enables --exact when used (default: none)
|
506
507
|
--restore - Remove @done tag from action
|
508
|
+
--search, --find, --grep=QUERY - Filter results using search terms (may be used more than once, default: none)
|
507
509
|
-t, --tag=TAG - Add a tag to the action, @tag(values) allowed, use multiple times or combine multiple tags with a comma (may be used more than once, default: none)
|
508
510
|
--tagged=TAG - Match actions containing tag. Allows value comparisons (may be used more than once, default: none)
|
509
511
|
--to, --move=PROJECT - Move action to specific project (default: none)
|
@@ -556,6 +558,7 @@ COMMAND OPTIONS
|
|
556
558
|
-n, --note - Prompt for additional notes. Input will be appended to any existing note. If STDIN input (piped) is detected, it will be used as a note.
|
557
559
|
-o, --overwrite - Overwrite note instead of appending
|
558
560
|
--proj, --project=PROJECT[/SUBPROJECT] - Affect actions from a specific project (default: none)
|
561
|
+
--search, --find, --grep=QUERY - Filter results using search terms (may be used more than once, default: none)
|
559
562
|
--tagged=TAG - Match actions containing tag. Allows value comparisons (may be used more than once, default: none)
|
560
563
|
--to, --move=PROJECT - Move action to specific project (default: none)
|
561
564
|
-x, --exact - Match pattern exactly
|
@@ -591,6 +594,7 @@ COMMAND OPTIONS
|
|
591
594
|
-n, --note - Prompt for additional notes. Input will be appended to any existing note. If STDIN input (piped) is detected, it will be used as a note.
|
592
595
|
-o, --overwrite - Overwrite note instead of appending
|
593
596
|
--proj, --project=PROJECT[/SUBPROJECT] - Affect actions from a specific project (default: none)
|
597
|
+
--search, --find, --grep=QUERY - Filter results using search terms (may be used more than once, default: none)
|
594
598
|
--tagged=TAG - Match actions containing tag. Allows value comparisons (may be used more than once, default: none)
|
595
599
|
-x, --exact - Match pattern exactly
|
596
600
|
|
data/bin/commands/archive.rb
CHANGED
@@ -37,6 +37,10 @@ class App
|
|
37
37
|
c.desc 'Act on all matches immediately (no menu)'
|
38
38
|
c.switch %i[all], negatable: false
|
39
39
|
|
40
|
+
c.desc 'Filter results using search terms'
|
41
|
+
c.arg_name 'QUERY'
|
42
|
+
c.flag %i[search find grep], multiple: true
|
43
|
+
|
40
44
|
c.desc 'Interpret search pattern as regular expression'
|
41
45
|
c.switch %i[e regex], negatable: false
|
42
46
|
|
@@ -48,9 +52,13 @@ class App
|
|
48
52
|
c.flag %i[in todo]
|
49
53
|
|
50
54
|
c.action do |global, options, args|
|
55
|
+
args.concat(options[:search])
|
56
|
+
|
51
57
|
if options[:done]
|
52
58
|
options[:tagged] << 'done'
|
53
59
|
options[:all] = true
|
60
|
+
else
|
61
|
+
options[:tagged] << '-done'
|
54
62
|
end
|
55
63
|
|
56
64
|
options[:done] = true
|
data/bin/commands/complete.rb
CHANGED
@@ -40,6 +40,10 @@ class App
|
|
40
40
|
c.arg_name 'DEPTH'
|
41
41
|
c.flag %i[d depth], must_match: /^[1-9]$/, type: :integer, default_value: 1
|
42
42
|
|
43
|
+
c.desc 'Filter results using search terms'
|
44
|
+
c.arg_name 'QUERY'
|
45
|
+
c.flag %i[search find grep], multiple: true
|
46
|
+
|
43
47
|
c.desc 'Match actions containing tag. Allows value comparisons'
|
44
48
|
c.arg_name 'TAG'
|
45
49
|
c.flag %i[tagged], multiple: true
|
@@ -54,6 +58,8 @@ class App
|
|
54
58
|
c.switch %i[x exact], negatable: false
|
55
59
|
|
56
60
|
c.action do |global, options, args|
|
61
|
+
args.concat(options[:search])
|
62
|
+
|
57
63
|
options[:finish] = true
|
58
64
|
options[:f] = true
|
59
65
|
options[:to] = 'Archive' if options[:archive] && !options[:to]
|
data/bin/commands/update.rb
CHANGED
@@ -55,6 +55,10 @@ class App
|
|
55
55
|
c.arg_name 'TAG'
|
56
56
|
c.flag %i[r remove], multiple: true
|
57
57
|
|
58
|
+
c.desc 'Use with --find to find and replace with new text. Enables --exact when used'
|
59
|
+
c.arg_name 'TEXT'
|
60
|
+
c.flag %i[replace]
|
61
|
+
|
58
62
|
c.desc 'Add a @done tag to action'
|
59
63
|
c.switch %i[f finish], negatable: false
|
60
64
|
|
@@ -79,6 +83,10 @@ class App
|
|
79
83
|
c.arg_name 'DEPTH'
|
80
84
|
c.flag %i[d depth], must_match: /^[1-9]$/, type: :integer, default_value: 1
|
81
85
|
|
86
|
+
c.desc 'Filter results using search terms'
|
87
|
+
c.arg_name 'QUERY'
|
88
|
+
c.flag %i[search find grep], multiple: true
|
89
|
+
|
82
90
|
c.desc 'Match actions containing tag. Allows value comparisons'
|
83
91
|
c.arg_name 'TAG'
|
84
92
|
c.flag %i[tagged], multiple: true
|
@@ -95,6 +103,8 @@ class App
|
|
95
103
|
c.action do |global_options, options, args|
|
96
104
|
reader = TTY::Reader.new
|
97
105
|
|
106
|
+
args.concat(options[:search])
|
107
|
+
|
98
108
|
append = options[:at] ? options[:at] =~ /^[ae]/i : global_options[:add_at] =~ /^[ae]/i
|
99
109
|
|
100
110
|
if options[:restore] || (!options[:remove].nil? && options[:remove].include?('done'))
|
@@ -106,6 +116,8 @@ class App
|
|
106
116
|
options[:tagged] << '-done'
|
107
117
|
end
|
108
118
|
|
119
|
+
options[:exact] = true unless options[:replace].nil?
|
120
|
+
|
109
121
|
action = if args.count.positive?
|
110
122
|
args.join(' ').strip
|
111
123
|
else
|
@@ -244,6 +256,7 @@ class App
|
|
244
256
|
priority: priority,
|
245
257
|
project: options[:project],
|
246
258
|
remove_tag: remove_tags,
|
259
|
+
replace: options[:replace],
|
247
260
|
tagged: tags)
|
248
261
|
end
|
249
262
|
end
|
data/lib/na/action.rb
CHANGED
@@ -95,13 +95,6 @@ module NA
|
|
95
95
|
file_tpl = "#{template[:file]}#{file} {x}"
|
96
96
|
filename = NA::Color.template(file_tpl)
|
97
97
|
|
98
|
-
# Add notes if needed
|
99
|
-
note = if notes && @note.count.positive?
|
100
|
-
NA::Color.template("\n#{@note.map { |l| " #{template[:note]}• #{l}{x}" }.join("\n")}")
|
101
|
-
else
|
102
|
-
''
|
103
|
-
end
|
104
|
-
|
105
98
|
# colorize the action and highlight tags
|
106
99
|
@action.gsub!(/\{(.*?)\}/, '\\{\1\\}')
|
107
100
|
action = NA::Color.template("#{template[:action]}#{@action.sub(/ @#{NA.na_tag}\b/, '')}{x}")
|
@@ -112,9 +105,27 @@ module NA
|
|
112
105
|
|
113
106
|
if detect_width
|
114
107
|
width = TTY::Screen.columns
|
115
|
-
prefix = NA::Color.uncolor(pretty(template: { templates: { output: template[:templates][:output].sub(/%action/, '') } }, detect_width: false))
|
108
|
+
prefix = NA::Color.uncolor(pretty(template: { templates: { output: template[:templates][:output].sub(/%action/, '').sub(/%note/, '') } }, detect_width: false))
|
116
109
|
indent = prefix.length
|
110
|
+
|
111
|
+
# Add notes if needed
|
112
|
+
note = if notes && @note.count.positive?
|
113
|
+
NA::Color.template(@note.wrap(width, indent, template[:note]))
|
114
|
+
elsif !notes && @note.count.positive?
|
115
|
+
action += "#{template[:note]}*"
|
116
|
+
else
|
117
|
+
''
|
118
|
+
end
|
119
|
+
|
117
120
|
action = action.wrap(width, indent)
|
121
|
+
else
|
122
|
+
note = if notes && @note.count.positive?
|
123
|
+
NA::Color.template("\n#{@note.map { |l| " #{template[:note]}• #{l.wrap(width, indent)}{x}" }.join("\n")}")
|
124
|
+
elsif !notes && @note.count.positive?
|
125
|
+
action += "#{template[:note]}*"
|
126
|
+
else
|
127
|
+
''
|
128
|
+
end
|
118
129
|
end
|
119
130
|
|
120
131
|
# Replace variables in template string and output colorized
|
data/lib/na/actions.rb
CHANGED
@@ -79,7 +79,7 @@ module NA
|
|
79
79
|
|
80
80
|
files.map { |f| NA.notify(f, debug: true) } if files
|
81
81
|
|
82
|
-
output = map { |action| action.pretty(template: { output: template }, regexes: regexes, notes: notes) }
|
82
|
+
output = map { |action| action.pretty(template: { templates: { output: template } }, regexes: regexes, notes: notes) }
|
83
83
|
NA::Pager.page(output.join("\n"))
|
84
84
|
end
|
85
85
|
end
|
data/lib/na/array.rb
CHANGED
@@ -10,4 +10,11 @@ class ::Array
|
|
10
10
|
def remove_bad
|
11
11
|
compact.map { |x| x.is_a?(String) ? x.strip : x }.select(&:good?)
|
12
12
|
end
|
13
|
+
|
14
|
+
def wrap(width, indent, color)
|
15
|
+
map! do |l|
|
16
|
+
"#{color}#{' ' * indent }• #{l.wrap(width, indent)}{x}"
|
17
|
+
end
|
18
|
+
"\n#{join("\n")}"
|
19
|
+
end
|
13
20
|
end
|
data/lib/na/colors.rb
CHANGED
@@ -84,7 +84,7 @@ module NA
|
|
84
84
|
# Array of attribute keys only
|
85
85
|
ATTRIBUTE_NAMES = ATTRIBUTES.transpose.first
|
86
86
|
|
87
|
-
# Returns true if
|
87
|
+
# Returns true if Color supports the +feature+.
|
88
88
|
#
|
89
89
|
# The feature :clear, that is mixing the clear color attribute into String,
|
90
90
|
# is only supported on ruby implementations, that do *not* already
|
data/lib/na/next_action.rb
CHANGED
@@ -244,6 +244,7 @@ module NA
|
|
244
244
|
project: nil,
|
245
245
|
move: nil,
|
246
246
|
remove_tag: [],
|
247
|
+
replace: nil,
|
247
248
|
tagged: nil)
|
248
249
|
|
249
250
|
projects = find_projects(target)
|
@@ -278,6 +279,15 @@ module NA
|
|
278
279
|
projects.select { |proj| proj.project =~ /^#{add.parent.join(':')}$/ }.first
|
279
280
|
end
|
280
281
|
|
282
|
+
res = NA.yn(NA::Color.template("#{NA.theme[:warning]}Project #{NA.theme[:file]}#{move}#{NA.theme[:warning]} doesn't exist, add it"), default: true)
|
283
|
+
|
284
|
+
if res
|
285
|
+
target_proj = insert_project(target, project, projects)
|
286
|
+
projects << target_proj
|
287
|
+
else
|
288
|
+
NA.notify("#{NA.theme[:error]}Cancelled", exit_code: 1)
|
289
|
+
end
|
290
|
+
|
281
291
|
NA.notify("#{NA.theme[:error]}Error parsing project #{NA.theme[:filename]}#{target}", exit_code: 1) if target_proj.nil?
|
282
292
|
|
283
293
|
indent = "\t" * target_proj.indent
|
@@ -328,6 +338,9 @@ module NA
|
|
328
338
|
action.note = new_note
|
329
339
|
end
|
330
340
|
|
341
|
+
# If replace is defined, use search to search and replace text in action
|
342
|
+
action.action.sub!(Regexp.new(Regexp.escape(search), Regexp::IGNORECASE), replace) if replace
|
343
|
+
|
331
344
|
action.process(priority: priority, finish: finish, add_tag: add_tag, remove_tag: remove_tag)
|
332
345
|
|
333
346
|
target_proj = if target_proj
|
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.47<!--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.48
|
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-09-
|
11
|
+
date: 2023-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -246,7 +246,6 @@ files:
|
|
246
246
|
- na.rdoc
|
247
247
|
- scripts/fixreadme.rb
|
248
248
|
- src/_README.md
|
249
|
-
- test2.txt
|
250
249
|
homepage: https://brettterpstra.com/projects/na/
|
251
250
|
licenses:
|
252
251
|
- MIT
|