na 1.2.73 → 1.2.75

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.
@@ -0,0 +1,170 @@
1
+ #!/usr/bin/env ruby
2
+ require 'tty-progressbar'
3
+ require 'shellwords'
4
+
5
+ class ::String
6
+ def short_desc
7
+ split(/[,.]/)[0].sub(/ \(.*?\)?$/, '').strip
8
+ end
9
+
10
+ def ltrunc(max)
11
+ if length > max
12
+ sub(/^.*?(.{#{max - 3}})$/, '...\1')
13
+ else
14
+ self
15
+ end
16
+ end
17
+
18
+ def ltrunc!(max)
19
+ replace ltrunc(max)
20
+ end
21
+ end
22
+
23
+ class FishCompletions
24
+
25
+ attr_accessor :commands, :global_options
26
+
27
+ def generate_helpers
28
+ <<~EOFUNCTIONS
29
+ function __fish_na_needs_command
30
+ # Figure out if the current invocation already has a command.
31
+
32
+ set -l opts a-add add_at= color cwd_as= d-depth= debug ext= f-file= help include_ext n-note p-priority= pager f-recurse t-na_tag= template= version
33
+ set cmd (commandline -opc)
34
+ set -e cmd[1]
35
+ argparse -s $opts -- $cmd 2>/dev/null
36
+ or return 0
37
+ # These flags function as commands, effectively.
38
+ if set -q argv[1]
39
+ # Also print the command, so this can be used to figure out what it is.
40
+ echo $argv[1]
41
+ return 1
42
+ end
43
+ return 0
44
+ end
45
+
46
+ function __fish_na_using_command
47
+ set -l cmd (__fish_na_needs_command)
48
+ test -z "$cmd"
49
+ and return 1
50
+ contains -- $cmd $argv
51
+ and return 0
52
+ end
53
+
54
+ function __fish_na_subcommands
55
+ na help -c
56
+ end
57
+
58
+ complete -c na -f
59
+ complete -xc na -n '__fish_na_needs_command' -a '(__fish_na_subcommands)'
60
+
61
+ complete -xc na -n '__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from (na help -c)' -a "(na help -c)"
62
+ EOFUNCTIONS
63
+ end
64
+
65
+ def get_help_sections(command = '')
66
+ res = `na help #{command}`.strip
67
+ scanned = res.scan(/(?m-i)^([A-Z ]+)\n([\s\S]*?)(?=\n+[A-Z]+|\Z)/)
68
+ sections = {}
69
+ scanned.each do |sect|
70
+ title = sect[0].downcase.strip.gsub(/ +/, '_').to_sym
71
+ content = sect[1].split(/\n/).map(&:strip).delete_if(&:empty?)
72
+ sections[title] = content
73
+ end
74
+ sections
75
+ end
76
+
77
+ def parse_option(option)
78
+ res = option.match(/(?:-(?<short>\w), )?(?:--(?:\[no-\])?(?<long>w+)(?:=(?<arg>\w+))?)\s+- (?<desc>.*?)$/)
79
+ return nil unless res
80
+ {
81
+ short: res['short'],
82
+ long: res['long'],
83
+ arg: res[:arg],
84
+ description: res['desc'].short_desc
85
+ }
86
+ end
87
+
88
+ def parse_options(options)
89
+ options.map { |opt| parse_option(opt) }
90
+ end
91
+
92
+ def parse_command(command)
93
+ res = command.match(/^(?<cmd>[^, \t]+)(?<alias>(?:, [^, \t]+)*)?\s+- (?<desc>.*?)$/)
94
+ commands = [res['cmd']]
95
+ commands.concat(res['alias'].split(/, /).delete_if(&:empty?)) if res['alias']
96
+
97
+ {
98
+ commands: commands,
99
+ description: res['desc'].short_desc
100
+ }
101
+ end
102
+
103
+ def parse_commands(commands)
104
+ commands.map { |cmd| parse_command(cmd) }
105
+ end
106
+
107
+ def generate_subcommand_completions
108
+ out = []
109
+ @commands.each_with_index do |cmd, i|
110
+ out << "complete -xc na -n '__fish_na_needs_command' -a '#{cmd[:commands].join(' ')}' -d #{Shellwords.escape(cmd[:description])}"
111
+ end
112
+
113
+ out.join("\n")
114
+ end
115
+
116
+ def generate_subcommand_option_completions
117
+
118
+ out = []
119
+ need_export = []
120
+
121
+ @commands.each_with_index do |cmd, i|
122
+ @bar.advance
123
+ data = get_help_sections(cmd[:commands].first)
124
+
125
+ if data[:synopsis].join(' ').strip.split(/ /).last =~ /(path|file)/i
126
+ out << "complete -c na -F -n '__fish_na_using_command #{cmd[:commands].join(" ")}'"
127
+ end
128
+
129
+ if data[:command_options]
130
+ parse_options(data[:command_options]).each do |option|
131
+ next if option.nil?
132
+
133
+ arg = option[:arg] ? '-r' : ''
134
+ short = option[:short] ? "-s #{option[:short]}" : ''
135
+ long = option[:long] ? "-l #{option[:long]}" : ''
136
+ out << "complete -c na #{long} #{short} -f #{arg} -n '__fish_na_using_command #{cmd[:commands].join(' ')}' -d #{Shellwords.escape(option[:description])}"
137
+
138
+ need_export.concat(cmd[:commands]) if option[:long] == 'output'
139
+ end
140
+ end
141
+ end
142
+
143
+ unless need_export.empty?
144
+ out << "complete -f -c na -s o -l output -x -n '__fish_na_using_command #{need_export.join(' ')}' -a '(__fish_na_export_plugins)'"
145
+ end
146
+
147
+ # clear
148
+ out.join("\n")
149
+ end
150
+
151
+ def initialize
152
+ data = get_help_sections
153
+ @global_options = parse_options(data[:global_options])
154
+ @commands = parse_commands(data[:commands])
155
+ @bar = TTY::ProgressBar.new("\033[0;0;33mGenerating Fish completions: \033[0;35;40m[:bar]\033[0m", total: @commands.count, bar_format: :blade)
156
+ @bar.resize(25)
157
+ end
158
+
159
+ def generate_completions
160
+ @bar.start
161
+ out = []
162
+ out << generate_helpers
163
+ out << generate_subcommand_completions
164
+ out << generate_subcommand_option_completions
165
+ @bar.finish
166
+ out.join("\n")
167
+ end
168
+ end
169
+
170
+ puts FishCompletions.new.generate_completions
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+
3
+ cd /planter
4
+ bundle update
5
+ rake test
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.72<!--END VER-->.
12
+ The current version of `na` is <!--VER-->1.2.74<!--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,28 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: na
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.73
4
+ version: 1.2.75
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-15 00:00:00.000000000 Z
10
+ date: 2025-03-17 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
- name: rake
13
+ name: minitest
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.9.2
18
+ version: '5.14'
19
19
  type: :development
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 0.9.2
25
+ version: '5.14'
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rdoc
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -38,67 +38,59 @@ dependencies:
38
38
  - !ruby/object:Gem::Version
39
39
  version: '4.3'
40
40
  - !ruby/object:Gem::Dependency
41
- name: minitest
42
- requirement: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: '5.14'
47
- type: :development
48
- prerelease: false
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '5.14'
54
- - !ruby/object:Gem::Dependency
55
- name: yard
41
+ name: chronic
56
42
  requirement: !ruby/object:Gem::Requirement
57
43
  requirements:
58
44
  - - "~>"
59
45
  - !ruby/object:Gem::Version
60
- version: '0.9'
46
+ version: '0.10'
61
47
  - - ">="
62
48
  - !ruby/object:Gem::Version
63
- version: 0.9.26
64
- type: :development
49
+ version: 0.10.2
50
+ type: :runtime
65
51
  prerelease: false
66
52
  version_requirements: !ruby/object:Gem::Requirement
67
53
  requirements:
68
54
  - - "~>"
69
55
  - !ruby/object:Gem::Version
70
- version: '0.9'
56
+ version: '0.10'
71
57
  - - ">="
72
58
  - !ruby/object:Gem::Version
73
- version: 0.9.26
59
+ version: 0.10.2
74
60
  - !ruby/object:Gem::Dependency
75
- name: rubocop
61
+ name: gli
76
62
  requirement: !ruby/object:Gem::Requirement
77
63
  requirements:
78
64
  - - "~>"
79
65
  - !ruby/object:Gem::Version
80
- version: '1.74'
81
- type: :development
66
+ version: 2.21.0
67
+ type: :runtime
82
68
  prerelease: false
83
69
  version_requirements: !ruby/object:Gem::Requirement
84
70
  requirements:
85
71
  - - "~>"
86
72
  - !ruby/object:Gem::Version
87
- version: '1.74'
73
+ version: 2.21.0
88
74
  - !ruby/object:Gem::Dependency
89
- name: gli
75
+ name: mdless
90
76
  requirement: !ruby/object:Gem::Requirement
91
77
  requirements:
92
78
  - - "~>"
93
79
  - !ruby/object:Gem::Version
94
- version: 2.21.0
80
+ version: '1.0'
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: 1.0.32
95
84
  type: :runtime
96
85
  prerelease: false
97
86
  version_requirements: !ruby/object:Gem::Requirement
98
87
  requirements:
99
88
  - - "~>"
100
89
  - !ruby/object:Gem::Version
101
- version: 2.21.0
90
+ version: '1.0'
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: 1.0.32
102
94
  - !ruby/object:Gem::Dependency
103
95
  name: tty-reader
104
96
  requirement: !ruby/object:Gem::Requirement
@@ -160,45 +152,25 @@ dependencies:
160
152
  - !ruby/object:Gem::Version
161
153
  version: 0.5.0
162
154
  - !ruby/object:Gem::Dependency
163
- name: chronic
155
+ name: tty-spinner
164
156
  requirement: !ruby/object:Gem::Requirement
165
157
  requirements:
166
158
  - - "~>"
167
159
  - !ruby/object:Gem::Version
168
- version: '0.10'
169
- - - ">="
170
- - !ruby/object:Gem::Version
171
- version: 0.10.2
172
- type: :runtime
173
- prerelease: false
174
- version_requirements: !ruby/object:Gem::Requirement
175
- requirements:
176
- - - "~>"
177
- - !ruby/object:Gem::Version
178
- version: '0.10'
179
- - - ">="
180
- - !ruby/object:Gem::Version
181
- version: 0.10.2
182
- - !ruby/object:Gem::Dependency
183
- name: mdless
184
- requirement: !ruby/object:Gem::Requirement
185
- requirements:
186
- - - "~>"
187
- - !ruby/object:Gem::Version
188
- version: '1.0'
160
+ version: '0.9'
189
161
  - - ">="
190
162
  - !ruby/object:Gem::Version
191
- version: 1.0.32
192
- type: :runtime
163
+ version: 0.9.0
164
+ type: :development
193
165
  prerelease: false
194
166
  version_requirements: !ruby/object:Gem::Requirement
195
167
  requirements:
196
168
  - - "~>"
197
169
  - !ruby/object:Gem::Version
198
- version: '1.0'
170
+ version: '0.9'
199
171
  - - ">="
200
172
  - !ruby/object:Gem::Version
201
- version: 1.0.32
173
+ version: 0.9.0
202
174
  description: A tool for managing a TaskPaper file of project todos for the current
203
175
  directory. Easily create "next actions" to come back to, add tags and priorities,
204
176
  and notes. Add prompt hooks to display your next actions automatically when cd'ing
@@ -211,6 +183,8 @@ extra_rdoc_files:
211
183
  - README.md
212
184
  - na.rdoc
213
185
  files:
186
+ - ".rubocop.yml"
187
+ - ".rubocop_todo.yml"
214
188
  - ".travis.yml"
215
189
  - CHANGELOG.md
216
190
  - Gemfile
@@ -241,6 +215,14 @@ files:
241
215
  - bin/commands/undo.rb
242
216
  - bin/commands/update.rb
243
217
  - bin/na
218
+ - docker/Dockerfile
219
+ - docker/Dockerfile-2.6
220
+ - docker/Dockerfile-2.7
221
+ - docker/Dockerfile-3.0
222
+ - docker/Dockerfile-3.3
223
+ - docker/bash_profile
224
+ - docker/inputrc
225
+ - docker/sources.list
244
226
  - lib/na.rb
245
227
  - lib/na/action.rb
246
228
  - lib/na/actions.rb
@@ -260,6 +242,8 @@ files:
260
242
  - na.gemspec
261
243
  - na.rdoc
262
244
  - scripts/fixreadme.rb
245
+ - scripts/generate-fish-completions.rb
246
+ - scripts/runtests.sh
263
247
  - src/_README.md
264
248
  - test.md
265
249
  - test2.txt
@@ -288,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
288
272
  - !ruby/object:Gem::Version
289
273
  version: '0'
290
274
  requirements: []
291
- rubygems_version: 3.6.5
275
+ rubygems_version: 3.6.6
292
276
  specification_version: 4
293
277
  summary: A command line tool for adding and listing project todos
294
278
  test_files: []