na 1.2.68 → 1.2.70

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: f4bab4837fdfd785bf98e3cfb57be87b633b89cb96bdd113b123a32f0b36d345
4
- data.tar.gz: b485160151d82ff3fc74725eaa481fe454aafbf82248f7fe1b8373ca17c2d2f8
3
+ metadata.gz: 56f715c29577f9b9e9d757574336719a2e288ccf3b115094e985bacb06e65fb8
4
+ data.tar.gz: d2fdb11e46d322f9efe4b3038ec2becd9a3becc51b8d7c4ff44ae028cd8912ac
5
5
  SHA512:
6
- metadata.gz: 6e294883202f7ffbf90d2aca9868cd63d9abc6509eb9fed08177b7b616e5edf9247daa38a7bc1b2bcc1501f62888dde39f7a2c7f2c473aa6159d01f231bb88e1
7
- data.tar.gz: ed451f210ba65a9c9fe375122842d37a572abd5ffc3a0c97ec06789450bc4fab1660e4cde5e9ce1d022ba27144a6dbf815043cf7e4479720ae3b69c4da2ae80a
6
+ metadata.gz: 2cad1158ba4c4477a88a949856bace92e261c435675ba56491e790a189299525168f1999fee5ecee7025f49dc54693bce3347034ea36782632dd3ddfb86835de
7
+ data.tar.gz: ea2f842e4cec6a2040bf730dfc60d683d15638b6db71496ab5e4b3b59bf566183a982d30ab65167e41a9eb6e0002c2061c135ebb22de0edd668b69e5575bb362
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ### 1.2.70
2
+
3
+ 2024-09-28 11:10
4
+
5
+ #### FIXED
6
+
7
+ - - @fixed Matching parenthetical notes at the end of a task entry was too greedy
8
+ - - - @fixed Matching parenthetical notes at the end of a task entry was too greedy
9
+
10
+ ### 1.2.69
11
+
12
+ 2024-09-28 11:09
13
+
14
+ #### FIXED
15
+
16
+ - - @fixed Matching parenthetical notes at the end of a task entry was too greedy
17
+
1
18
  ### 1.2.68
2
19
 
3
20
  2024-06-23 14:30
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- na (1.2.68)
4
+ na (1.2.70)
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.68.
12
+ The current version of `na` is 1.2.70.
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
 
@@ -76,7 +76,7 @@ SYNOPSIS
76
76
  na [global options] command [command options] [arguments...]
77
77
 
78
78
  VERSION
79
- 1.2.68
79
+ 1.2.70
80
80
 
81
81
  GLOBAL OPTIONS
82
82
  -a, --add - Add a next action (deprecated, for backwards compatibility)
data/bin/commands/add.rb CHANGED
@@ -2,57 +2,57 @@
2
2
 
3
3
  class App
4
4
  extend GLI::App
5
- desc 'Add a new next action'
5
+ desc "Add a new next action"
6
6
  long_desc 'Provides an easy way to store todos while you work. Add quick
7
7
  reminders and (if you set up Prompt Hooks) they\'ll automatically display
8
8
  next time you enter the directory.
9
9
 
10
10
  If multiple todo files are found in the current directory, a menu will
11
11
  allow you to pick to which file the action gets added.'
12
- arg_name 'ACTION'
12
+ arg_name "ACTION"
13
13
  command :add do |c|
14
- c.example 'na add "A cool feature I thought of @idea"', desc: 'Add a new action to the Inbox, including a tag'
14
+ c.example 'na add "A cool feature I thought of @idea"', desc: "Add a new action to the Inbox, including a tag"
15
15
  c.example 'na add "A bug I need to fix" -p 4 -n',
16
- desc: 'Add a new action to the Inbox, set its @priority to 4, and prompt for an additional note.'
16
+ desc: "Add a new action to the Inbox, set its @priority to 4, and prompt for an additional note."
17
17
  c.example 'na add "An action item (with a note)"',
18
- desc: 'A parenthetical at the end of an action is interpreted as a note'
18
+ desc: "A parenthetical at the end of an action is interpreted as a note"
19
19
 
20
- c.desc 'Prompt for additional notes. STDIN input (piped) will be treated as a note if present.'
20
+ c.desc "Prompt for additional notes. STDIN input (piped) will be treated as a note if present."
21
21
  c.switch %i[n note], negatable: false
22
22
 
23
- c.desc 'Add a priority level 1-5'
24
- c.arg_name 'PRIO'
23
+ c.desc "Add a priority level 1-5"
24
+ c.arg_name "PRIO"
25
25
  c.flag %i[p priority], must_match: /[1-5]/, type: :integer, default_value: 0
26
26
 
27
- c.desc 'Add action to specific project'
28
- c.arg_name 'PROJECT'
29
- c.default_value 'Inbox'
27
+ c.desc "Add action to specific project"
28
+ c.arg_name "PROJECT"
29
+ c.default_value "Inbox"
30
30
  c.flag %i[to project proj]
31
31
 
32
- c.desc 'Add task at [s]tart or [e]nd of target project'
33
- c.arg_name 'POSITION'
32
+ c.desc "Add task at [s]tart or [e]nd of target project"
33
+ c.arg_name "POSITION"
34
34
  c.flag %i[at], must_match: /^[sbea].*?$/i
35
35
 
36
- c.desc 'Add to a known todo file, partial matches allowed'
37
- c.arg_name 'TODO_FILE'
36
+ c.desc "Add to a known todo file, partial matches allowed"
37
+ c.arg_name "TODO_FILE"
38
38
  c.flag %i[in todo]
39
39
 
40
- c.desc 'Use a tag other than the default next action tag'
41
- c.arg_name 'TAG'
40
+ c.desc "Use a tag other than the default next action tag"
41
+ c.arg_name "TAG"
42
42
  c.flag %i[t tag]
43
43
 
44
44
  c.desc 'Don\'t add next action tag to new entry'
45
45
  c.switch %i[x], negatable: false
46
46
 
47
- c.desc 'Specify the file to which the task should be added'
48
- c.arg_name 'PATH'
47
+ c.desc "Specify the file to which the task should be added"
48
+ c.arg_name "PATH"
49
49
  c.flag %i[f file]
50
50
 
51
- c.desc 'Mark task as @done with date'
51
+ c.desc "Mark task as @done with date"
52
52
  c.switch %i[finish done], negatable: false
53
53
 
54
- c.desc 'Search for files X directories deep'
55
- c.arg_name 'DEPTH'
54
+ c.desc "Search for files X directories deep"
55
+ c.arg_name "DEPTH"
56
56
  c.flag %i[d depth], must_match: /^[1-9]$/, type: :integer, default_value: 1
57
57
 
58
58
  c.action do |global_options, options, args|
@@ -87,33 +87,31 @@ class App
87
87
  options[:todo].split(/ *, */).each do |a|
88
88
  m = a.match(/^(?<req>[+\-!])?(?<tok>.*?)$/)
89
89
  todo.push({
90
- token: m['tok'],
91
- required: all_req || (!m['req'].nil? && m['req'] == '+'),
92
- negate: !m['req'].nil? && m['req'] =~ /[!\-]/
90
+ token: m["tok"],
91
+ required: all_req || (!m["req"].nil? && m["req"] == "+"),
92
+ negate: !m["req"].nil? && m["req"] =~ /[!\-]/,
93
93
  })
94
94
  end
95
95
  dirs = NA.match_working_dir(todo)
96
96
  if dirs.count.positive?
97
97
  target = dirs[0]
98
98
  else
99
- todo = "#{options[:todo].sub(/#{NA.extension}$/, '')}.#{NA.extension}"
99
+ todo = "#{options[:todo].sub(/#{NA.extension}$/, "")}.#{NA.extension}"
100
100
  target = File.expand_path(todo)
101
101
  unless File.exist?(target)
102
-
103
102
  res = NA.yn(NA::Color.template("#{NA.theme[:warning]}Specified file not found, create #{todo}"), default: true)
104
103
  NA.notify("#{NA.theme[:error]}Cancelled{x}", exit_code: 1) unless res
105
104
 
106
105
  basename = File.basename(target, ".#{NA.extension}")
107
106
  NA.create_todo(target, basename, template: global_options[:template])
108
107
  end
109
-
110
108
  end
111
109
  else
112
110
  files = NA.find_files(depth: options[:depth])
113
111
  if files.count.zero?
114
112
  res = NA.yn(NA::Color.template("#{NA.theme[:warning]}No todo file found, create one"), default: true)
115
113
  if res
116
- basename = File.expand_path('.').split('/').last
114
+ basename = File.expand_path(".").split("/").last
117
115
  target = "#{basename}.#{NA.extension}"
118
116
  NA.create_todo(target, basename, template: global_options[:template])
119
117
  files = NA.find_files(depth: 1)
@@ -121,59 +119,58 @@ class App
121
119
  end
122
120
  target = files.count > 1 ? NA.select_file(files) : files[0]
123
121
  NA.notify("#{NA.theme[:error]}Cancelled{x}", exit_code: 1) unless files.count.positive? && File.exist?(target)
124
-
125
122
  end
126
123
 
127
124
  action = if args.count.positive?
128
- args.join(' ').strip
129
- else
130
- NA.request_input(options, prompt: 'Enter a task')
131
- end
125
+ args.join(" ").strip
126
+ else
127
+ NA.request_input(options, prompt: "Enter a task")
128
+ end
132
129
 
133
130
  if action.nil? || action.empty?
134
- puts 'Empty input, cancelled'
131
+ puts "Empty input, cancelled"
135
132
  Process.exit 1
136
133
  end
137
134
 
135
+ note_rx = /^(.+) \(([^)]+)\)$/
136
+ split_note = if action =~ note_rx
137
+ n = Regexp.last_match(2)
138
+ action.sub!(note_rx, '\1').strip!
139
+ n
140
+ end
141
+
138
142
  if options[:priority]&.to_i&.positive?
139
- action = "#{action.gsub(/@priority\(\d+\)/, '')} @priority(#{options[:priority]})"
143
+ action = "#{action.gsub(/@priority\(\d+\)/, "")} @priority(#{options[:priority]})"
140
144
  end
141
145
 
142
- note_rx = /^(.+) \((.*?)\)$/
143
- split_note = if action =~ note_rx
144
- n = Regexp.last_match(2)
145
- action.sub!(note_rx, '\1').strip!
146
- n
147
- end
148
-
149
146
  na_tag = NA.na_tag
150
147
  if options[:x]
151
- na_tag = ''
148
+ na_tag = ""
152
149
  else
153
150
  na_tag = options[:tag] unless options[:tag].nil?
154
151
  na_tag = " @#{na_tag}"
155
152
  end
156
153
 
157
- action = "#{action.gsub(/#{na_tag}\b/, '')}#{na_tag}"
154
+ action = "#{action.gsub(/#{na_tag}\b/, "")}#{na_tag}"
158
155
 
159
156
  stdin_note = NA.stdin ? NA.stdin.split("\n") : []
160
157
 
161
158
  line_note = if options[:note] && $stdin.isatty
162
- puts stdin_note unless stdin_note.nil?
163
- if TTY::Which.exist?('gum')
164
- args = ['--placeholder "Enter additional note, CTRL-d to save"']
165
- args << '--char-limit 0'
166
- args << '--width $(tput cols)'
167
- `gum write #{args.join(' ')}`.strip.split("\n")
168
- else
169
- NA.notify("#{NA.theme[:prompt]}Enter a note, {bw}CTRL-d#{NA.theme[:prompt]} to end editing#{NA.theme[:action]}")
170
- reader.read_multiline
171
- end
172
- end
159
+ puts stdin_note unless stdin_note.nil?
160
+ if TTY::Which.exist?("gum")
161
+ args = ['--placeholder "Enter additional note, CTRL-d to save"']
162
+ args << "--char-limit 0"
163
+ args << "--width $(tput cols)"
164
+ `gum write #{args.join(" ")}`.strip.split("\n")
165
+ else
166
+ NA.notify("#{NA.theme[:prompt]}Enter a note, {bw}CTRL-d#{NA.theme[:prompt]} to end editing#{NA.theme[:action]}")
167
+ reader.read_multiline
168
+ end
169
+ end
173
170
 
174
171
  note = stdin_note.empty? ? [] : stdin_note
175
- note.concat(split_note) unless split_note.nil?
176
- note.concat(line_note) unless line_note.nil?
172
+ note.<< split_note unless split_note.nil?
173
+ note << line_note unless line_note.nil?
177
174
 
178
175
  NA.add_action(target, options[:project], action, note, finish: options[:finish], append: append)
179
176
  end
data/lib/na/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Na
2
- VERSION = '1.2.68'
2
+ VERSION = '1.2.70'
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.67<!--END VER-->.
12
+ The current version of `na` is <!--VER-->1.2.68<!--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.68
4
+ version: 1.2.70
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-23 00:00:00.000000000 Z
11
+ date: 2024-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -276,7 +276,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
276
276
  - !ruby/object:Gem::Version
277
277
  version: '0'
278
278
  requirements: []
279
- rubygems_version: 3.5.11
279
+ rubygems_version: 3.5.14
280
280
  signing_key:
281
281
  specification_version: 4
282
282
  summary: A command line tool for adding and listing project todos