na 1.2.74 → 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.73<!--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,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: na
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.74
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-16 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
13
  name: minitest
@@ -23,20 +23,6 @@ dependencies:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
25
  version: '5.14'
26
- - !ruby/object:Gem::Dependency
27
- name: rake
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - "~>"
31
- - !ruby/object:Gem::Version
32
- version: 0.9.2
33
- type: :development
34
- prerelease: false
35
- version_requirements: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: 0.9.2
40
26
  - !ruby/object:Gem::Dependency
41
27
  name: rdoc
42
28
  requirement: !ruby/object:Gem::Requirement
@@ -51,40 +37,6 @@ dependencies:
51
37
  - - "~>"
52
38
  - !ruby/object:Gem::Version
53
39
  version: '4.3'
54
- - !ruby/object:Gem::Dependency
55
- name: rubocop
56
- requirement: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '1.74'
61
- type: :development
62
- prerelease: false
63
- version_requirements: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '1.74'
68
- - !ruby/object:Gem::Dependency
69
- name: yard
70
- requirement: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '0.9'
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- version: 0.9.26
78
- type: :development
79
- prerelease: false
80
- version_requirements: !ruby/object:Gem::Requirement
81
- requirements:
82
- - - "~>"
83
- - !ruby/object:Gem::Version
84
- version: '0.9'
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- version: 0.9.26
88
40
  - !ruby/object:Gem::Dependency
89
41
  name: chronic
90
42
  requirement: !ruby/object:Gem::Requirement
@@ -199,6 +151,26 @@ dependencies:
199
151
  - - ">="
200
152
  - !ruby/object:Gem::Version
201
153
  version: 0.5.0
154
+ - !ruby/object:Gem::Dependency
155
+ name: tty-spinner
156
+ requirement: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - "~>"
159
+ - !ruby/object:Gem::Version
160
+ version: '0.9'
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: 0.9.0
164
+ type: :development
165
+ prerelease: false
166
+ version_requirements: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - "~>"
169
+ - !ruby/object:Gem::Version
170
+ version: '0.9'
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
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: []