term_utils 0.4.0 → 0.5.0

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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/COPYING +1 -1
  4. data/Rakefile +6 -0
  5. data/doc/TermUtils/AP/Article.html +13 -13
  6. data/doc/TermUtils/AP/ArticleResult.html +4 -4
  7. data/doc/TermUtils/AP/Flag.html +8 -8
  8. data/doc/TermUtils/AP/Parameter.html +9 -9
  9. data/doc/TermUtils/AP/ParameterResult.html +4 -4
  10. data/doc/TermUtils/AP/ParameterWalkerHooks.html +4 -4
  11. data/doc/TermUtils/AP/ParseError.html +646 -14
  12. data/doc/TermUtils/AP/Parser.html +43 -15
  13. data/doc/TermUtils/AP/Result.html +4 -4
  14. data/doc/TermUtils/AP/Syntax.html +4 -4
  15. data/doc/TermUtils/AP/SyntaxError.html +4 -86
  16. data/doc/TermUtils/AP/Walker.html +4 -4
  17. data/doc/TermUtils/AP.html +16 -16
  18. data/doc/TermUtils/FF/Config.html +8 -8
  19. data/doc/TermUtils/FF/Context.html +4 -4
  20. data/doc/TermUtils/FF/Entry.html +4 -4
  21. data/doc/TermUtils/FF/Finder.html +850 -0
  22. data/doc/TermUtils/FF/FinderEntry.html +1191 -0
  23. data/doc/TermUtils/FF/FinderQuery.html +946 -0
  24. data/doc/TermUtils/FF/Query.html +11 -15
  25. data/doc/TermUtils/FF.html +131 -7
  26. data/doc/TermUtils/PropertyTreeNode.html +6 -6
  27. data/doc/TermUtils/Tab/Column.html +44 -44
  28. data/doc/TermUtils/Tab/Header.html +19 -19
  29. data/doc/TermUtils/Tab/Holder.html +40 -40
  30. data/doc/TermUtils/Tab/Printer.html +4 -4
  31. data/doc/TermUtils/Tab/Table.html +59 -59
  32. data/doc/TermUtils/Tab/TableError.html +4 -86
  33. data/doc/TermUtils/Tab.html +42 -42
  34. data/doc/TermUtils.html +6 -6
  35. data/doc/_index.html +29 -23
  36. data/doc/class_list.html +1 -1
  37. data/doc/css/style.css +1 -0
  38. data/doc/file.README.html +25 -21
  39. data/doc/frames.html +1 -1
  40. data/doc/index.html +25 -21
  41. data/doc/method_list.html +385 -89
  42. data/doc/top-level-namespace.html +4 -4
  43. data/lib/term_utils/ap/article.rb +2 -2
  44. data/lib/term_utils/ap/flag.rb +2 -2
  45. data/lib/term_utils/ap/parameter.rb +2 -2
  46. data/lib/term_utils/ap/parser.rb +16 -15
  47. data/lib/term_utils/ap/result.rb +2 -2
  48. data/lib/term_utils/ap/syntax.rb +2 -2
  49. data/lib/term_utils/ap.rb +66 -22
  50. data/lib/term_utils/ff/config.rb +3 -3
  51. data/lib/term_utils/ff/entry.rb +2 -2
  52. data/lib/term_utils/ff/finder.rb +255 -0
  53. data/lib/term_utils/ff/query.rb +6 -8
  54. data/lib/term_utils/ff.rb +4 -3
  55. data/lib/term_utils/property_tree_node.rb +3 -3
  56. data/lib/term_utils/tab.rb +14 -13
  57. data/lib/term_utils.rb +2 -2
  58. data/term_utils.gemspec +2 -2
  59. metadata +8 -5
  60. data/doc/TermUtils/AP/NoSuchValueError.html +0 -217
@@ -1,6 +1,6 @@
1
- # frozen-string-literal: true
1
+ # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2020 Thomas Baron
3
+ # Copyright (C) 2023 Thomas Baron
4
4
  #
5
5
  # This file is part of term_utils.
6
6
  #
@@ -16,14 +16,13 @@
16
16
  # You should have received a copy of the GNU General Public License
17
17
  # along with term_utils. If not, see <https://www.gnu.org/licenses/>.
18
18
 
19
+ require 'stringio'
20
+
19
21
  module TermUtils
20
22
  # The tab module provides a way to print formatted tables.
21
23
  module Tab
22
24
  # Represents a table error.
23
25
  class TableError < StandardError
24
- def initialize(msg)
25
- super
26
- end
27
26
  end
28
27
 
29
28
  # Creates initial column properties.
@@ -218,9 +217,9 @@ module TermUtils
218
217
  offset = opts.fetch(:offset)
219
218
  column_separator_width = opts.fetch(:column_separator_width)
220
219
  sb = StringIO.new
221
- sb << ' ' * offset if offset.positive?
220
+ sb << (' ' * offset) if offset.positive?
222
221
  @columns.each do |col|
223
- sb << ' ' * column_separator_width if col.index.positive?
222
+ sb << (' ' * column_separator_width) if col.index.positive?
224
223
  sb << col.render_header(vals[col.index])
225
224
  end
226
225
  io.puts sb.string
@@ -247,9 +246,9 @@ module TermUtils
247
246
  offset = opts.fetch(:offset)
248
247
  column_separator_width = opts.fetch(:column_separator_width)
249
248
  sb = StringIO.new
250
- sb << ' ' * offset if offset.positive?
249
+ sb << (' ' * offset) if offset.positive?
251
250
  @columns.each do |col|
252
- sb << ' ' * column_separator_width if col.index.positive?
251
+ sb << (' ' * column_separator_width) if col.index.positive?
253
252
  sb << col.render_data(vals[col.index])
254
253
  end
255
254
  io.puts sb.string
@@ -265,10 +264,10 @@ module TermUtils
265
264
  offset = opts.fetch(:offset)
266
265
  column_separator_width = opts.fetch(:column_separator_width)
267
266
  sb = StringIO.new
268
- sb << ' ' * offset if offset.positive?
267
+ sb << (' ' * offset) if offset.positive?
269
268
  @columns.each do |col|
270
- sb << ' ' * column_separator_width if col.index.positive?
271
- sb << '-' * col.width
269
+ sb << (' ' * column_separator_width) if col.index.positive?
270
+ sb << ('-' * col.width)
272
271
  end
273
272
  io.puts sb.string
274
273
  end
@@ -358,7 +357,7 @@ module TermUtils
358
357
  src = @format % val
359
358
  end
360
359
  end
361
- src = src.is_a?(String) ? src : src.to_s
360
+ src = src.to_s unless src.is_a?(String)
362
361
  TermUtils::Tab.align_cut(src, @align, @fixed, @width, @ellipsis)
363
362
  end
364
363
  end
@@ -387,6 +386,7 @@ module TermUtils
387
386
  raise TermUtils::Tab::TableError, 'wrong header align (not :left or :right)' unless %i[left right].index(@align)
388
387
  end
389
388
  end
389
+
390
390
  # Represents a table printer.
391
391
  class Printer
392
392
  # @return [Tab::Table]
@@ -439,6 +439,7 @@ module TermUtils
439
439
  @table.print_separator(@io, opts ? @options.merge(opts) : @options)
440
440
  end
441
441
  end
442
+
442
443
  # Represents a Holder of Table(s).
443
444
  class Holder
444
445
  # @return [Hash] `:offset`, `:column_separator_width`.
data/lib/term_utils.rb CHANGED
@@ -1,6 +1,6 @@
1
- # frozen-string-literal: true
1
+ # frozen_string_literal: true
2
2
 
3
- # Copyright (C) 2020 Thomas Baron
3
+ # Copyright (C) 2023 Thomas Baron
4
4
  #
5
5
  # This file is part of term_utils.
6
6
  #
data/term_utils.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "term_utils"
3
- s.version = "0.4.0"
4
- s.date = "2020-08-02"
3
+ s.version = "0.5.0"
4
+ s.date = "2023-08-09"
5
5
  s.summary = "Utilities for terminal application."
6
6
  s.description = <<-EOS
7
7
  Utilities for terminal application like argument parsing, table formatting and file finding.
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: term_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Baron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-02 00:00:00.000000000 Z
11
+ date: 2023-08-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'Utilities for terminal application like argument parsing, table formatting
14
14
  and file finding.
15
15
 
16
- '
16
+ '
17
17
  email: tvbaron at gmail dot com
18
18
  executables: []
19
19
  extensions: []
@@ -29,7 +29,6 @@ files:
29
29
  - doc/TermUtils/AP/Article.html
30
30
  - doc/TermUtils/AP/ArticleResult.html
31
31
  - doc/TermUtils/AP/Flag.html
32
- - doc/TermUtils/AP/NoSuchValueError.html
33
32
  - doc/TermUtils/AP/Parameter.html
34
33
  - doc/TermUtils/AP/ParameterResult.html
35
34
  - doc/TermUtils/AP/ParameterWalkerHooks.html
@@ -43,6 +42,9 @@ files:
43
42
  - doc/TermUtils/FF/Config.html
44
43
  - doc/TermUtils/FF/Context.html
45
44
  - doc/TermUtils/FF/Entry.html
45
+ - doc/TermUtils/FF/Finder.html
46
+ - doc/TermUtils/FF/FinderEntry.html
47
+ - doc/TermUtils/FF/FinderQuery.html
46
48
  - doc/TermUtils/FF/Query.html
47
49
  - doc/TermUtils/PropertyTreeNode.html
48
50
  - doc/TermUtils/Tab.html
@@ -77,6 +79,7 @@ files:
77
79
  - lib/term_utils/ff.rb
78
80
  - lib/term_utils/ff/config.rb
79
81
  - lib/term_utils/ff/entry.rb
82
+ - lib/term_utils/ff/finder.rb
80
83
  - lib/term_utils/ff/query.rb
81
84
  - lib/term_utils/property_tree_node.rb
82
85
  - lib/term_utils/tab.rb
@@ -101,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
104
  - !ruby/object:Gem::Version
102
105
  version: '0'
103
106
  requirements: []
104
- rubygems_version: 3.0.3
107
+ rubygems_version: 3.4.18
105
108
  signing_key:
106
109
  specification_version: 4
107
110
  summary: Utilities for terminal application.
@@ -1,217 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>
7
- Exception: TermUtils::AP::NoSuchValueError
8
-
9
- &mdash; Documentation by YARD 0.9.25
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="../../css/style.css" type="text/css" />
14
-
15
- <link rel="stylesheet" href="../../css/common.css" type="text/css" />
16
-
17
- <script type="text/javascript">
18
- pathId = "TermUtils::AP::NoSuchValueError";
19
- relpath = '../../';
20
- </script>
21
-
22
-
23
- <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
24
-
25
- <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
26
-
27
-
28
- </head>
29
- <body>
30
- <div class="nav_wrap">
31
- <iframe id="nav" src="../../class_list.html?1"></iframe>
32
- <div id="resizer"></div>
33
- </div>
34
-
35
- <div id="main" tabindex="-1">
36
- <div id="header">
37
- <div id="menu">
38
-
39
- <a href="../../_index.html">Index (N)</a> &raquo;
40
- <span class='title'><span class='object_link'><a href="../../TermUtils.html" title="TermUtils (module)">TermUtils</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../AP.html" title="TermUtils::AP (module)">AP</a></span></span>
41
- &raquo;
42
- <span class="title">NoSuchValueError</span>
43
-
44
- </div>
45
-
46
- <div id="search">
47
-
48
- <a class="full_list_link" id="class_list_link"
49
- href="../../class_list.html">
50
-
51
- <svg width="24" height="24">
52
- <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
- <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
- <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
- </svg>
56
- </a>
57
-
58
- </div>
59
- <div class="clear"></div>
60
- </div>
61
-
62
- <div id="content"><h1>Exception: TermUtils::AP::NoSuchValueError
63
-
64
-
65
-
66
- </h1>
67
- <div class="box_info">
68
-
69
- <dl>
70
- <dt>Inherits:</dt>
71
- <dd>
72
- <span class="inheritName">StandardError</span>
73
-
74
- <ul class="fullTree">
75
- <li>Object</li>
76
-
77
- <li class="next">StandardError</li>
78
-
79
- <li class="next">TermUtils::AP::NoSuchValueError</li>
80
-
81
- </ul>
82
- <a href="#" class="inheritanceTree">show all</a>
83
-
84
- </dd>
85
- </dl>
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
- <dl>
98
- <dt>Defined in:</dt>
99
- <dd>lib/term_utils/ap.rb</dd>
100
- </dl>
101
-
102
- </div>
103
-
104
- <h2>Overview</h2><div class="docstring">
105
- <div class="discussion">
106
-
107
- <p>NoSuchValueError.</p>
108
-
109
-
110
- </div>
111
- </div>
112
- <div class="tags">
113
-
114
-
115
- </div>
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
- <h2>
124
- Instance Method Summary
125
- <small><a href="#" class="summary_toggle">collapse</a></small>
126
- </h2>
127
-
128
- <ul class="summary">
129
-
130
- <li class="public ">
131
- <span class="summary_signature">
132
-
133
- <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(msg) &#x21d2; NoSuchValueError </a>
134
-
135
-
136
-
137
- </span>
138
-
139
-
140
- <span class="note title constructor">constructor</span>
141
-
142
-
143
-
144
-
145
-
146
-
147
-
148
-
149
- <span class="summary_desc"><div class='inline'>
150
- <p>A new instance of NoSuchValueError.</p>
151
- </div></span>
152
-
153
- </li>
154
-
155
-
156
- </ul>
157
-
158
-
159
-
160
- <div id="constructor_details" class="method_details_list">
161
- <h2>Constructor Details</h2>
162
-
163
- <div class="method_details first">
164
- <h3 class="signature first" id="initialize-instance_method">
165
-
166
- #<strong>initialize</strong>(msg) &#x21d2; <tt><span class='object_link'><a href="" title="TermUtils::AP::NoSuchValueError (class)">NoSuchValueError</a></span></tt>
167
-
168
-
169
-
170
-
171
-
172
- </h3><div class="docstring">
173
- <div class="discussion">
174
-
175
- <p>Returns a new instance of NoSuchValueError.</p>
176
-
177
-
178
- </div>
179
- </div>
180
- <div class="tags">
181
-
182
-
183
- </div><table class="source_code">
184
- <tr>
185
- <td>
186
- <pre class="lines">
187
-
188
-
189
- 24
190
- 25
191
- 26</pre>
192
- </td>
193
- <td>
194
- <pre class="code"><span class="info file"># File 'lib/term_utils/ap.rb', line 24</span>
195
-
196
- <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='rparen'>)</span>
197
- <span class='kw'>super</span>
198
- <span class='kw'>end</span></pre>
199
- </td>
200
- </tr>
201
- </table>
202
- </div>
203
-
204
- </div>
205
-
206
-
207
- </div>
208
-
209
- <div id="footer">
210
- Generated on Sun Aug 2 18:35:09 2020 by
211
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
212
- 0.9.25 (ruby-2.6.5).
213
- </div>
214
-
215
- </div>
216
- </body>
217
- </html>