na 1.2.22 → 1.2.24

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: ccb815bfd051b4cd15b198c14ff1bb1efcde847005d88aa4322d88aec4ac8d72
4
- data.tar.gz: 75ce04d2a86f842668118e5e58497627c5616618479b7838f4f6fcd34baf910a
3
+ metadata.gz: 2f840ae45f83c67e9090e06825967148c02aae1fcb31171fb04fcaf5bc67ef71
4
+ data.tar.gz: 0aee7636a1b17b0a631b16df18a06e1e5dc62636e86eeae1b1f8e2486476063b
5
5
  SHA512:
6
- metadata.gz: 2cee616b47b7ee5918d9062a48f38ff45ec4ee6a20fe3027b31c778d4fe7d08881ac5138498cc02b1e66c691c925a35f8b3d72a1ca23d034b48853ad7ac87540
7
- data.tar.gz: d262fb01720b1b9daa30c26b75ef1771e047ba8879cc04ca66be6076a7c99aa143ed3d2a0b254785bee0c0f95fa76ab0cbf282199dc3fd0867c1ec12edc81df2
6
+ metadata.gz: 2d99c6628ec7bf9c01556bd4fba39456088c59e5702f6e5227a1c34dee73f8078fea15fd46d60f217b4ee2f5bc4e1e17fafa62c9aa9b585431c7acc955331608
7
+ data.tar.gz: eaeb4890a28bc8d3d8d0c12cb76e50d2e591e81b0eef104cae994b8ee0e0798cf693740a6160578e8a77329d503481e5231ef340980920f621e6ee5001ffa5e8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ### 1.2.24
2
+
3
+ 2023-06-14 09:16
4
+
5
+ ### 1.2.23
6
+
7
+ 2023-06-05 10:42
8
+
9
+ #### FIXED
10
+
11
+ - Actually implement the --template option
12
+
1
13
  ### 1.2.22
2
14
 
3
15
  2023-06-05 10:35
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- na (1.2.22)
4
+ na (1.2.24)
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.22
12
+ The current version of `na` is 1.2.24
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,23 +77,23 @@ SYNOPSIS
77
77
  na [global options] command [command options] [arguments...]
78
78
 
79
79
  VERSION
80
- 1.2.22
80
+ 1.2.24
81
81
 
82
82
  GLOBAL OPTIONS
83
83
  -a, --add - Add a next action (deprecated, for backwards compatibility)
84
84
  --add_at=POSITION - Add all new/moved entries at [s]tart or [e]nd of target project (default: start)
85
85
  --[no-]color - Colorize output (default: enabled)
86
86
  --cwd_as=TYPE - Use current working directory as [p]roject, [t]ag, or [n]one (default: none)
87
- -d, --depth=DEPTH - Recurse to depth (default: 1)
87
+ -d, --depth=DEPTH - Recurse to depth (default: 3)
88
88
  --[no-]debug - Display verbose output
89
89
  --ext=EXT - File extension to consider a todo file (default: taskpaper)
90
- -f, --file=PATH - Use a single file as global todo, use --initconfig to make permanent (default: none)
90
+ -f, --file=PATH - Use a single file as global todo, use initconfig to make permanent (default: none)
91
91
  --help - Show this message
92
92
  -n, --note - Prompt for additional notes (deprecated, for backwards compatibility)
93
93
  -p, --priority=PRIORITY - Set a priority 0-5 (deprecated, for backwards compatibility) (default: none)
94
94
  -r, --[no-]recurse - Recurse 3 directories deep (deprecated, for backwards compatability)
95
95
  -t, --na_tag=TAG - Tag to consider a next action (default: na)
96
- --template=PATH - Provide a template for new/blank todo files, use --initconfig to make permanent (default: none)
96
+ --template=PATH - Provide a template for new/blank todo files, use initconfig to make permanent (default: none)
97
97
  --version - Display the program version
98
98
 
99
99
  COMMANDS
data/bin/na CHANGED
@@ -43,11 +43,11 @@ class App
43
43
  arg_name 'PRIORITY'
44
44
  flag %i[p priority]
45
45
 
46
- desc 'Use a single file as global todo, use --initconfig to make permanent'
46
+ desc 'Use a single file as global todo, use initconfig to make permanent'
47
47
  arg_name 'PATH'
48
48
  flag %i[f file]
49
49
 
50
- desc 'Provide a template for new/blank todo files, use --initconfig to make permanent'
50
+ desc 'Provide a template for new/blank todo files, use initconfig to make permanent'
51
51
  arg_name 'PATH'
52
52
  flag %[template]
53
53
 
@@ -278,7 +278,7 @@ class App
278
278
  res = NA.yn(NA::Color.template('{by}Specified file not found, create it'), default: true)
279
279
  if res
280
280
  basename = File.basename(target, ".#{NA.extension}")
281
- NA.create_todo(target, basename)
281
+ NA.create_todo(target, basename, template: global_options[:template])
282
282
  else
283
283
  puts NA::Color.template('{r}Cancelled{x}')
284
284
  Process.exit 1
@@ -290,7 +290,7 @@ class App
290
290
  res = NA.yn(NA::Color.template('{by}Specified file not found, create it'), default: true)
291
291
  if res
292
292
  basename = File.basename(target, ".#{NA.extension}")
293
- NA.create_todo(target, basename)
293
+ NA.create_todo(target, basename, template: global_options[:template])
294
294
  else
295
295
  puts NA::Color.template('{r}Cancelled{x}')
296
296
  Process.exit 1
@@ -319,7 +319,7 @@ class App
319
319
  NA.notify('{r}Cancelled{x}', exit_code: 1) unless res
320
320
 
321
321
  basename = File.basename(target, ".#{NA.extension}")
322
- NA.create_todo(target, basename)
322
+ NA.create_todo(target, basename, template: global_options[:template])
323
323
  end
324
324
 
325
325
  end
@@ -330,7 +330,7 @@ class App
330
330
  if res
331
331
  basename = File.expand_path('.').split('/').last
332
332
  target = "#{basename}.#{NA.extension}"
333
- NA.create_todo(target, basename)
333
+ NA.create_todo(target, basename, template: global_options[:template])
334
334
  files = NA.find_files(depth: 1)
335
335
  end
336
336
  end
@@ -906,7 +906,7 @@ class App
906
906
  c.example 'na init', desc: 'Generate a new todo file, prompting for project name'
907
907
  c.example 'na init warpspeed', desc: 'Generate a new todo for a project called warpspeed'
908
908
 
909
- c.action do |_global_options, _options, args|
909
+ c.action do |global_options, _options, args|
910
910
  reader = TTY::Reader.new
911
911
  if args.count.positive?
912
912
  project = args.join(' ')
@@ -923,7 +923,7 @@ class App
923
923
 
924
924
  end
925
925
 
926
- NA.create_todo(target, project)
926
+ NA.create_todo(target, project, template: global_options[:template])
927
927
  end
928
928
  end
929
929
 
@@ -166,7 +166,7 @@ module NA
166
166
  [projects, selected]
167
167
  end
168
168
 
169
- def insert_project(target, project)
169
+ def insert_project(target, project, projects)
170
170
  path = project.split(%r{[:/]})
171
171
  _, _, projects = parse_actions(file_path: target)
172
172
  built = []
@@ -196,9 +196,13 @@ module NA
196
196
  end
197
197
 
198
198
  if new_path.join('') =~ /Archive/i
199
- content = "#{content.strip}\n#{input.join("\n")}"
199
+ line = projects.last.last_line
200
+ content = content.split(/\n/).insert(line, input.join("\n")).join("\n")
200
201
  else
201
- content = "#{input.join("\n")}\n#{content}"
202
+ split = content.split(/\n/)
203
+ before = split.slice(0, projects.first.line).join("\n")
204
+ after = split.slice(projects.first.line, split.count - projects.first.line).join("\n")
205
+ content = "#{before}\n#{input.join("\n")}\n#{after}"
202
206
  end
203
207
 
204
208
  new_project = NA::Project.new(path.map(&:cap_first).join(':'), indent - 1, input.count - 1, input.count - 1)
@@ -210,7 +214,7 @@ module NA
210
214
  input.push("#{"\t" * indent}#{part.cap_first}:")
211
215
  indent += 1
212
216
  end
213
- content = content.split("\n").insert(line, input.join("\n")).join("\n")
217
+ content = content.split(/\n/).insert(line, input.join("\n")).join("\n")
214
218
  new_project = NA::Project.new(path.map(&:cap_first).join(':'), indent - 1, line + input.count - 1, line + input.count - 1)
215
219
  end
216
220
 
@@ -273,7 +277,7 @@ module NA
273
277
  if target_proj.nil?
274
278
  res = NA.yn(NA::Color.template("{y}Project {bw}#{project}{xy} doesn't exist, add it"), default: true)
275
279
  if res
276
- target_proj = insert_project(target, project)
280
+ target_proj = insert_project(target, project, projects)
277
281
  else
278
282
  NA.notify('{x}Cancelled', exit_code: 1)
279
283
  end
data/lib/na/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Na
2
- VERSION = '1.2.22'
2
+ VERSION = '1.2.24'
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.21<!--END VER-->.
12
+ The current version of `na` is <!--VER-->1.2.22<!--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.22
4
+ version: 1.2.24
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-06-05 00:00:00.000000000 Z
11
+ date: 2023-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
246
  - !ruby/object:Gem::Version
247
247
  version: '0'
248
248
  requirements: []
249
- rubygems_version: 3.2.15
249
+ rubygems_version: 3.2.16
250
250
  signing_key:
251
251
  specification_version: 4
252
252
  summary: A command line tool for adding and listing project todos