na 1.2.45 → 1.2.46

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: 999328238e283419f4e31a30244177baed7a0aca57b5c112dc29434d68c039f0
4
- data.tar.gz: 6d0182ffc278c67ed1d44701d0e7fb7ec68de947ad592fefa2e4494bf8ca09d4
3
+ metadata.gz: '0847ca8c8b5746d6e0f099c5bfc38d00dd01353acc7bceda6c5c6423ed16630f'
4
+ data.tar.gz: 6e7eecaf402a4268826095e6b46b4f1fad26a7e454b6162a6ef113f04e91a660
5
5
  SHA512:
6
- metadata.gz: a0e0db55f26d7a136c179ebd1a391e3822cee860e72b22bc227d2d5321fd8ec659619ed33f3cfb93e8ca25d3da7d072b12ceea9717c8f4bd499dd9ab2dd814a2
7
- data.tar.gz: 3bf8afbfd84a9b19699c0bdfa443c3e0b46f4557188e5a3d19b9cf99123e0fff3a3baa943b31f1c084435e4e37ea7f59c90a3dfaa1825cdea93d5d88f83fc2c5
6
+ metadata.gz: 794d54bd290f665f51bb1d74846c83a4406ba76568132591ab19fe146bbbbce844be4e6fff2be05c73170f3666a87edc5446bf1380d1a7c8ded9848fbba9c4a9
7
+ data.tar.gz: de1cea81c7612bf8beaa0b73243aa687e9325d46e0c93d139cda87d6792fb99a2614812671b68f6ae9961adde9040c669ce73c5ae1f39d1215820187345ca21b
data/.travis.yml CHANGED
@@ -4,7 +4,7 @@ sudo: required
4
4
  dist: trusty
5
5
  cache: bundler
6
6
  rvm:
7
- - ruby-3.0.0
7
+ - ruby-3.1.0
8
8
  install:
9
9
  - gem install bundler --version '2.2.29'
10
10
  - bundle install
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ### 1.2.46
2
+
3
+ 2023-09-06 21:25
4
+
5
+ #### IMPROVED
6
+
7
+ - Add `--project` to archive and update
8
+ - Add `--project` flag to complete
9
+
10
+ #### FIXED
11
+
12
+ - Error when creating new project in todo file
13
+
1
14
  ### 1.2.45
2
15
 
3
16
  2023-09-06 19:19
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- na (1.2.45)
4
+ na (1.2.46)
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.45
12
+ The current version of `na` is 1.2.46
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.45
80
+ 1.2.46
81
81
 
82
82
  GLOBAL OPTIONS
83
83
  -a, --add - Add a next action (deprecated, for backwards compatibility)
@@ -487,26 +487,27 @@ DESCRIPTION
487
487
  Provides an easy way to complete, prioritize, and tag existing actions. If multiple todo files are found in the current directory, a menu will allow you to pick which file to act on.
488
488
 
489
489
  COMMAND OPTIONS
490
- -a, --archive - Add a @done tag to action and move to Archive
491
- --all - Act on all matches immediately (no menu)
492
- --at=POSITION - When moving task, add at [s]tart or [e]nd of target project (default: none)
493
- -d, --depth=DEPTH - Search for files X directories deep (default: 1)
494
- --delete - Delete an action
495
- --[no-]done - Include @done actions
496
- -e, --regex - Interpret search pattern as regular expression
497
- --edit - Open action in editor (vim). Natural language dates will be parsed and converted in date-based tags.
498
- -f, --finish - Add a @done tag to action
499
- --file=PATH - Specify the file to search for the task (default: none)
500
- --in, --todo=TODO_FILE - Use a known todo file, partial matches allowed (default: none)
501
- -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.
502
- -o, --overwrite - Overwrite note instead of appending
503
- -p, --priority=PRIO - Add/change a priority level 1-5 (default: 0)
504
- -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)
505
- --restore - Remove @done tag from action
506
- -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)
507
- --tagged=TAG - Match actions containing tag. Allows value comparisons (may be used more than once, default: none)
508
- --to, --project, --proj=PROJECT - Move action to specific project (default: none)
509
- -x, --exact - Match pattern exactly
490
+ -a, --archive - Add a @done tag to action and move to Archive
491
+ --all - Act on all matches immediately (no menu)
492
+ --at=POSITION - When moving task, add at [s]tart or [e]nd of target project (default: none)
493
+ -d, --depth=DEPTH - Search for files X directories deep (default: 1)
494
+ --delete - Delete an action
495
+ --[no-]done - Include @done actions
496
+ -e, --regex - Interpret search pattern as regular expression
497
+ --edit - Open action in editor (vim). Natural language dates will be parsed and converted in date-based tags.
498
+ -f, --finish - Add a @done tag to action
499
+ --file=PATH - Specify the file to search for the task (default: none)
500
+ --in, --todo=TODO_FILE - Use a known todo file, partial matches allowed (default: none)
501
+ -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.
502
+ -o, --overwrite - Overwrite note instead of appending
503
+ -p, --priority=PRIO - Add/change a priority level 1-5 (default: 0)
504
+ --proj, --project=PROJECT[/SUBPROJECT] - Affect actions from a specific project (default: none)
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
+ --restore - Remove @done tag from action
507
+ -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
+ --tagged=TAG - Match actions containing tag. Allows value comparisons (may be used more than once, default: none)
509
+ --to, --move=PROJECT - Move action to specific project (default: none)
510
+ -x, --exact - Match pattern exactly
510
511
 
511
512
  EXAMPLES
512
513
 
@@ -546,17 +547,18 @@ SYNOPSIS
546
547
  na [global options] complete [command options] ACTION
547
548
 
548
549
  COMMAND OPTIONS
549
- -a, --archive - Add a @done tag to action and move to Archive
550
- --all - Act on all matches immediately (no menu)
551
- -d, --depth=DEPTH - Search for files X directories deep (default: 1)
552
- -e, --regex - Interpret search pattern as regular expression
553
- --file=PATH - Specify the file to search for the task (default: none)
554
- --in, --todo=TODO_FILE - Use a known todo file, partial matches allowed (default: none)
555
- -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.
556
- -o, --overwrite - Overwrite note instead of appending
557
- --tagged=TAG - Match actions containing tag. Allows value comparisons (may be used more than once, default: none)
558
- --to, --project, --proj=PROJECT - Move action to specific project (default: none)
559
- -x, --exact - Match pattern exactly
550
+ -a, --archive - Add a @done tag to action and move to Archive
551
+ --all - Act on all matches immediately (no menu)
552
+ -d, --depth=DEPTH - Search for files X directories deep (default: 1)
553
+ -e, --regex - Interpret search pattern as regular expression
554
+ --file=PATH - Specify the file to search for the task (default: none)
555
+ --in, --todo=TODO_FILE - Use a known todo file, partial matches allowed (default: none)
556
+ -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
+ -o, --overwrite - Overwrite note instead of appending
558
+ --proj, --project=PROJECT[/SUBPROJECT] - Affect actions from a specific project (default: none)
559
+ --tagged=TAG - Match actions containing tag. Allows value comparisons (may be used more than once, default: none)
560
+ --to, --move=PROJECT - Move action to specific project (default: none)
561
+ -x, --exact - Match pattern exactly
560
562
 
561
563
  EXAMPLES
562
564
 
@@ -580,15 +582,17 @@ SYNOPSIS
580
582
  na [global options] archive [command options] ACTION
581
583
 
582
584
  COMMAND OPTIONS
583
- --all - Act on all matches immediately (no menu)
584
- -d, --depth=DEPTH - Search for files X directories deep (default: 1)
585
- --done - Archive all done tasks
586
- -e, --regex - Interpret search pattern as regular expression
587
- --file=PATH - Specify the file to search for the task (default: none)
588
- -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.
589
- -o, --overwrite - Overwrite note instead of appending
590
- --tagged=TAG - Match actions containing tag. Allows value comparisons (may be used more than once, default: none)
591
- -x, --exact - Match pattern exactly
585
+ --all - Act on all matches immediately (no menu)
586
+ -d, --depth=DEPTH - Search for files X directories deep (default: 1)
587
+ --done - Archive all done tasks
588
+ -e, --regex - Interpret search pattern as regular expression
589
+ --file=PATH - Specify the file to search for the task (default: none)
590
+ --in, --todo=TODO_FILE - Use a known todo file, partial matches allowed (default: none)
591
+ -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
+ -o, --overwrite - Overwrite note instead of appending
593
+ --proj, --project=PROJECT[/SUBPROJECT] - Affect actions from a specific project (default: none)
594
+ --tagged=TAG - Match actions containing tag. Allows value comparisons (may be used more than once, default: none)
595
+ -x, --exact - Match pattern exactly
592
596
 
593
597
  EXAMPLE
594
598
 
@@ -30,6 +30,10 @@ class App
30
30
  c.arg_name 'TAG'
31
31
  c.flag %i[tagged], multiple: true
32
32
 
33
+ c.desc 'Affect actions from a specific project'
34
+ c.arg_name 'PROJECT[/SUBPROJECT]'
35
+ c.flag %i[proj project]
36
+
33
37
  c.desc 'Act on all matches immediately (no menu)'
34
38
  c.switch %i[all], negatable: false
35
39
 
@@ -39,15 +43,20 @@ class App
39
43
  c.desc 'Match pattern exactly'
40
44
  c.switch %i[x exact], negatable: false
41
45
 
46
+ c.desc 'Use a known todo file, partial matches allowed'
47
+ c.arg_name 'TODO_FILE'
48
+ c.flag %i[in todo]
49
+
42
50
  c.action do |global, options, args|
43
51
  if options[:done]
44
- options[:tagged] = ['done']
52
+ options[:tagged] << 'done'
45
53
  options[:all] = true
46
54
  end
47
55
 
48
56
  options[:done] = true
57
+ options['done'] = true
49
58
  options[:finish] = true
50
- options[:project] = 'Archive'
59
+ options[:move] = 'Archive'
51
60
  options[:archive] = true
52
61
  options[:a] = true
53
62
 
@@ -22,7 +22,11 @@ class App
22
22
 
23
23
  c.desc 'Move action to specific project'
24
24
  c.arg_name 'PROJECT'
25
- c.flag %i[to project proj]
25
+ c.flag %i[to move]
26
+
27
+ c.desc 'Affect actions from a specific project'
28
+ c.arg_name 'PROJECT[/SUBPROJECT]'
29
+ c.flag %i[proj project]
26
30
 
27
31
  c.desc 'Specify the file to search for the task'
28
32
  c.arg_name 'PATH'
@@ -52,7 +56,8 @@ class App
52
56
  c.action do |global, options, args|
53
57
  options[:finish] = true
54
58
  options[:f] = true
55
- options[:project] = 'Archive' if options[:archive] && !options[:project]
59
+ options[:to] = 'Archive' if options[:archive] && !options[:to]
60
+ options[:move] = 'Archive' if options[:archive] && !options[:move]
56
61
 
57
62
  cmd = commands[:update]
58
63
  action = cmd.send(:get_action, nil)
@@ -33,7 +33,11 @@ class App
33
33
 
34
34
  c.desc 'Move action to specific project'
35
35
  c.arg_name 'PROJECT'
36
- c.flag %i[to project proj]
36
+ c.flag %i[to move]
37
+
38
+ c.desc 'Affect actions from a specific project'
39
+ c.arg_name 'PROJECT[/SUBPROJECT]'
40
+ c.flag %i[proj project]
37
41
 
38
42
  c.desc 'Use a known todo file, partial matches allowed'
39
43
  c.arg_name 'TODO_FILE'
@@ -90,6 +94,7 @@ class App
90
94
 
91
95
  c.action do |global_options, options, args|
92
96
  reader = TTY::Reader.new
97
+
93
98
  append = options[:at] ? options[:at] =~ /^[ae]/i : global_options[:add_at] =~ /^[ae]/i
94
99
 
95
100
  if options[:restore] || (!options[:remove].nil? && options[:remove].include?('done'))
@@ -97,7 +102,7 @@ class App
97
102
  options[:tagged] << '+done'
98
103
  elsif !options[:remove].nil? && !options[:remove].empty?
99
104
  options[:tagged].concat(options[:remove])
100
- elsif options[:finish]
105
+ elsif options[:finish] && !options[:done]
101
106
  options[:tagged] << '-done'
102
107
  end
103
108
 
@@ -168,8 +173,8 @@ class App
168
173
  note = stdin_note.empty? ? [] : stdin_note
169
174
  note.concat(line_note) unless line_note.nil? || line_note.empty?
170
175
 
171
- target_proj = if options[:project]
172
- options[:project]
176
+ target_proj = if options[:move]
177
+ options[:move]
173
178
  elsif NA.cwd_is == :project
174
179
  NA.cwd
175
180
  end
@@ -204,7 +209,7 @@ class App
204
209
  files = NA.find_files_matching({
205
210
  depth: options[:depth],
206
211
  done: options[:done],
207
- project: target_proj,
212
+ project: options[:project],
208
213
  regex: options[:regex],
209
214
  require_na: false,
210
215
  search: tokens,
@@ -219,7 +224,7 @@ class App
219
224
 
220
225
  if options[:archive]
221
226
  options[:finish] = true
222
- options[:project] = 'Archive'
227
+ options[:move] = 'Archive'
223
228
  end
224
229
 
225
230
  NA.notify("#{NA.theme[:error]}No search terms provided", exit_code: 1) if tokens.nil? && options[:tagged].empty?
@@ -233,10 +238,11 @@ class App
233
238
  done: options[:done],
234
239
  edit: options[:edit],
235
240
  finish: options[:finish],
241
+ move: target_proj,
236
242
  note: note,
237
243
  overwrite: options[:overwrite],
238
244
  priority: priority,
239
- project: target_proj,
245
+ project: options[:project],
240
246
  remove_tag: remove_tags,
241
247
  tagged: tags)
242
248
  end
data/lib/na/action.rb CHANGED
@@ -59,6 +59,7 @@ module NA
59
59
  @project: #{@project}
60
60
  @parent: #{@parent.join('>')}
61
61
  @action: #{@action}
62
+ @tags: #{@tags}
62
63
  @note: #{@note}
63
64
  EOINSPECT
64
65
  end
@@ -102,6 +103,7 @@ module NA
102
103
  end
103
104
 
104
105
  # colorize the action and highlight tags
106
+ @action.gsub!(/\{(.*?)\}/, '\\{\1\\}')
105
107
  action = NA::Color.template("#{template[:action]}#{@action.sub(/ @#{NA.na_tag}\b/, '')}{x}")
106
108
  action = action.highlight_tags(color: template[:tags],
107
109
  parens: template[:value_parens],
@@ -184,7 +186,6 @@ module NA
184
186
  return false if keys.empty?
185
187
 
186
188
  key = keys[0]
187
-
188
189
  return true if tag[:comp].nil?
189
190
 
190
191
  tag_val = @tags[key]
@@ -139,10 +139,11 @@ module NA
139
139
  todo.projects
140
140
  end
141
141
 
142
- def find_actions(target, search, tagged = nil, all: false, done: false)
142
+ def find_actions(target, search, tagged = nil, all: false, done: false, project: nil)
143
143
  todo = NA::Todo.new({ search: search,
144
144
  require_na: false,
145
145
  file_path: target,
146
+ project: project,
146
147
  tag: tagged,
147
148
  done: done })
148
149
 
@@ -241,6 +242,7 @@ module NA
241
242
  overwrite: false,
242
243
  priority: 0,
243
244
  project: nil,
245
+ move: nil,
244
246
  remove_tag: [],
245
247
  tagged: nil)
246
248
 
@@ -248,13 +250,14 @@ module NA
248
250
 
249
251
  target_proj = nil
250
252
 
251
- if project
252
- project = project.sub(/:$/, '')
253
- target_proj = projects.select { |pr| pr.project =~ /#{project.gsub(/:/, '.*?:.*?')}/i }.first
253
+ if move
254
+ move = move.sub(/:$/, '')
255
+ target_proj = projects.select { |pr| pr.project =~ /#{move.gsub(/:/, '.*?:.*?')}/i }.first
254
256
  if target_proj.nil?
255
- res = NA.yn(NA::Color.template("#{NA.theme[:warning]}Project #{NA.theme[:file]}#{project}#{NA.theme[:warning]} doesn't exist, add it"), default: true)
257
+ res = NA.yn(NA::Color.template("#{NA.theme[:warning]}Project #{NA.theme[:file]}#{move}#{NA.theme[:warning]} doesn't exist, add it"), default: true)
256
258
  if res
257
- target_proj = insert_project(target, project, projects)
259
+ target_proj = insert_project(target, move, projects)
260
+ projects << target_proj
258
261
  else
259
262
  NA.notify("#{NA.theme[:error]}Cancelled", exit_code: 1)
260
263
  end
@@ -308,7 +311,7 @@ module NA
308
311
 
309
312
  notify(add.pretty)
310
313
  else
311
- _, actions = find_actions(target, search, tagged, done: done, all: all)
314
+ _, actions = find_actions(target, search, tagged, done: done, all: all, project: project)
312
315
 
313
316
  return if actions.nil?
314
317
 
@@ -489,23 +492,22 @@ module NA
489
492
  tag: nil
490
493
  }
491
494
  opts = defaults.merge(options)
492
-
493
495
  files = find_files(depth: options[:depth])
494
-
495
496
  files.delete_if do |file|
496
- todo = NA::Todo.new({
497
- depth: options[:depth],
498
- done: options[:done],
499
- file_path: file,
500
- negate: options[:negate],
501
- project: options[:project],
502
- query: options[:query],
503
- regex: options[:regex],
504
- require_na: options[:require_na],
505
- search: options[:search],
506
- tag: options[:tag]
507
- })
508
- todo.actions.length.zero?
497
+ cmd_options = {
498
+ depth: options[:depth],
499
+ done: options[:done],
500
+ file_path: file,
501
+ negate: options[:negate],
502
+ project: options[:project],
503
+ query: options[:query],
504
+ regex: options[:regex],
505
+ require_na: options[:require_na],
506
+ search: options[:search],
507
+ tag: options[:tag]
508
+ }
509
+ todo = NA::Todo.new(cmd_options)
510
+ todo.actions.empty?
509
511
  end
510
512
 
511
513
  files
data/lib/na/todo.rb CHANGED
@@ -61,7 +61,7 @@ module NA
61
61
  required_tag.push(t) if t[:required] && t[:negate]
62
62
  negated_tag.push(t) unless t[:negate]
63
63
  else
64
- optional_tag.push(t) unless t[:negate]
64
+ optional_tag.push(t) unless t[:negate] || t[:required]
65
65
  required_tag.push(t) if t[:required] && !t[:negate]
66
66
  negated_tag.push(t) if t[:negate]
67
67
  end
@@ -133,11 +133,9 @@ module NA
133
133
  next if settings[:require_na] && !line.na?
134
134
 
135
135
  has_search = !optional.empty? || !required.empty? || !negated.empty?
136
-
137
136
  next if has_search && !new_action.search_match?(any: optional,
138
137
  all: required,
139
138
  none: negated)
140
-
141
139
  if settings[:project]
142
140
  rx = settings[:project].split(%r{[/:]}).join('.*?/')
143
141
  next unless parent.join('/') =~ Regexp.new("#{rx}.*?", Regexp::IGNORECASE)
data/lib/na/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Na
2
- VERSION = '1.2.45'
2
+ VERSION = '1.2.46'
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.44<!--END VER-->.
12
+ The current version of `na` is <!--VER-->1.2.45<!--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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: na
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.45
4
+ version: 1.2.46
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra