my_help 1.2.8 → 1.2.10

Sign up to get free protection for your applications and to get access to all the features.
data/doc/method_list.html CHANGED
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html>
2
+ <html >
3
3
  <head>
4
4
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
5
5
  <meta charset="utf-8" />
@@ -38,7 +38,10 @@
38
38
 
39
39
  </div>
40
40
 
41
- <div id="search">Search: <input type="text" /></div>
41
+ <div id="search">
42
+ <label for="search-class">Search:</label>
43
+ <input id="search-class" type="text" />
44
+ </div>
42
45
  </div>
43
46
 
44
47
  <ul id="full_list" class="method">
@@ -53,6 +56,14 @@
53
56
 
54
57
 
55
58
  <li class="even ">
59
+ <div class="item">
60
+ <span class='object_link'><a href="MyHelp/CLI.html#add_defaults-instance_method" title="MyHelp::CLI#add_defaults (method)">#add_defaults</a></span>
61
+ <small>MyHelp::CLI</small>
62
+ </div>
63
+ </li>
64
+
65
+
66
+ <li class="odd ">
56
67
  <div class="item">
57
68
  <span class='object_link'><a href="MyHelp/Init.html#check_conf_exist-instance_method" title="MyHelp::Init#check_conf_exist (method)">#check_conf_exist</a></span>
58
69
  <small>MyHelp::Init</small>
@@ -60,6 +71,14 @@
60
71
  </li>
61
72
 
62
73
 
74
+ <li class="even ">
75
+ <div class="item">
76
+ <span class='object_link'><a href="MyHelp/Config.html#check_template_dir-instance_method" title="MyHelp::Config#check_template_dir (method)">#check_template_dir</a></span>
77
+ <small>MyHelp::Config</small>
78
+ </div>
79
+ </li>
80
+
81
+
63
82
  <li class="odd ">
64
83
  <div class="item">
65
84
  <span class='object_link'><a href="MyHelp/Config.html#config-instance_method" title="MyHelp::Config#config (method)">#config</a></span>
@@ -86,16 +105,16 @@
86
105
 
87
106
  <li class="even ">
88
107
  <div class="item">
89
- <span class='object_link'><a href="MyHelp/Org2Hash.html#contents-instance_method" title="MyHelp::Org2Hash#contents (method)">#contents</a></span>
90
- <small>MyHelp::Org2Hash</small>
108
+ <span class='object_link'><a href="MyHelp/Md2Hash.html#contents-instance_method" title="MyHelp::Md2Hash#contents (method)">#contents</a></span>
109
+ <small>MyHelp::Md2Hash</small>
91
110
  </div>
92
111
  </li>
93
112
 
94
113
 
95
114
  <li class="odd ">
96
115
  <div class="item">
97
- <span class='object_link'><a href="MyHelp/Md2Hash.html#contents-instance_method" title="MyHelp::Md2Hash#contents (method)">#contents</a></span>
98
- <small>MyHelp::Md2Hash</small>
116
+ <span class='object_link'><a href="MyHelp/Org2Hash.html#contents-instance_method" title="MyHelp::Org2Hash#contents (method)">#contents</a></span>
117
+ <small>MyHelp::Org2Hash</small>
99
118
  </div>
100
119
  </li>
101
120
 
@@ -110,16 +129,16 @@
110
129
 
111
130
  <li class="odd ">
112
131
  <div class="item">
113
- <span class='object_link'><a href="MyHelp/Modify.html#delete-instance_method" title="MyHelp::Modify#delete (method)">#delete</a></span>
114
- <small>MyHelp::Modify</small>
132
+ <span class='object_link'><a href="MyHelp/CLI.html#delete-instance_method" title="MyHelp::CLI#delete (method)">#delete</a></span>
133
+ <small>MyHelp::CLI</small>
115
134
  </div>
116
135
  </li>
117
136
 
118
137
 
119
138
  <li class="even ">
120
139
  <div class="item">
121
- <span class='object_link'><a href="MyHelp/CLI.html#delete-instance_method" title="MyHelp::CLI#delete (method)">#delete</a></span>
122
- <small>MyHelp::CLI</small>
140
+ <span class='object_link'><a href="MyHelp/Modify.html#delete-instance_method" title="MyHelp::Modify#delete (method)">#delete</a></span>
141
+ <small>MyHelp::Modify</small>
123
142
  </div>
124
143
  </li>
125
144
 
@@ -206,56 +225,56 @@
206
225
 
207
226
  <li class="odd ">
208
227
  <div class="item">
209
- <span class='object_link'><a href="Org2Yaml.html#initialize-instance_method" title="Org2Yaml#initialize (method)">#initialize</a></span>
210
- <small>Org2Yaml</small>
228
+ <span class='object_link'><a href="MyHelp/Config.html#initialize-instance_method" title="MyHelp::Config#initialize (method)">#initialize</a></span>
229
+ <small>MyHelp::Config</small>
211
230
  </div>
212
231
  </li>
213
232
 
214
233
 
215
234
  <li class="even ">
216
235
  <div class="item">
217
- <span class='object_link'><a href="MyHelp/Org2Hash.html#initialize-instance_method" title="MyHelp::Org2Hash#initialize (method)">#initialize</a></span>
218
- <small>MyHelp::Org2Hash</small>
236
+ <span class='object_link'><a href="MyHelp/List.html#initialize-instance_method" title="MyHelp::List#initialize (method)">#initialize</a></span>
237
+ <small>MyHelp::List</small>
219
238
  </div>
220
239
  </li>
221
240
 
222
241
 
223
242
  <li class="odd ">
224
243
  <div class="item">
225
- <span class='object_link'><a href="MyHelp/Init.html#initialize-instance_method" title="MyHelp::Init#initialize (method)">#initialize</a></span>
226
- <small>MyHelp::Init</small>
244
+ <span class='object_link'><a href="Org2Yaml.html#initialize-instance_method" title="Org2Yaml#initialize (method)">#initialize</a></span>
245
+ <small>Org2Yaml</small>
227
246
  </div>
228
247
  </li>
229
248
 
230
249
 
231
250
  <li class="even ">
232
251
  <div class="item">
233
- <span class='object_link'><a href="MyHelp/List.html#initialize-instance_method" title="MyHelp::List#initialize (method)">#initialize</a></span>
234
- <small>MyHelp::List</small>
252
+ <span class='object_link'><a href="MyHelp/Init.html#initialize-instance_method" title="MyHelp::Init#initialize (method)">#initialize</a></span>
253
+ <small>MyHelp::Init</small>
235
254
  </div>
236
255
  </li>
237
256
 
238
257
 
239
258
  <li class="odd ">
240
259
  <div class="item">
241
- <span class='object_link'><a href="MyHelp/Config.html#initialize-instance_method" title="MyHelp::Config#initialize (method)">#initialize</a></span>
242
- <small>MyHelp::Config</small>
260
+ <span class='object_link'><a href="MyHelp/Org2Hash.html#initialize-instance_method" title="MyHelp::Org2Hash#initialize (method)">#initialize</a></span>
261
+ <small>MyHelp::Org2Hash</small>
243
262
  </div>
244
263
  </li>
245
264
 
246
265
 
247
266
  <li class="even ">
248
267
  <div class="item">
249
- <span class='object_link'><a href="MyHelp/Modify.html#initialize-instance_method" title="MyHelp::Modify#initialize (method)">#initialize</a></span>
250
- <small>MyHelp::Modify</small>
268
+ <span class='object_link'><a href="MyHelp/Md2Hash.html#initialize-instance_method" title="MyHelp::Md2Hash#initialize (method)">#initialize</a></span>
269
+ <small>MyHelp::Md2Hash</small>
251
270
  </div>
252
271
  </li>
253
272
 
254
273
 
255
274
  <li class="odd ">
256
275
  <div class="item">
257
- <span class='object_link'><a href="MyHelp/Md2Hash.html#initialize-instance_method" title="MyHelp::Md2Hash#initialize (method)">#initialize</a></span>
258
- <small>MyHelp::Md2Hash</small>
276
+ <span class='object_link'><a href="MyHelp/Modify.html#initialize-instance_method" title="MyHelp::Modify#initialize (method)">#initialize</a></span>
277
+ <small>MyHelp::Modify</small>
259
278
  </div>
260
279
  </li>
261
280
 
@@ -318,16 +337,16 @@
318
337
 
319
338
  <li class="odd ">
320
339
  <div class="item">
321
- <span class='object_link'><a href="MyHelp/CLI.html#new-instance_method" title="MyHelp::CLI#new (method)">#new</a></span>
322
- <small>MyHelp::CLI</small>
340
+ <span class='object_link'><a href="MyHelp/Modify.html#new-instance_method" title="MyHelp::Modify#new (method)">#new</a></span>
341
+ <small>MyHelp::Modify</small>
323
342
  </div>
324
343
  </li>
325
344
 
326
345
 
327
346
  <li class="even ">
328
347
  <div class="item">
329
- <span class='object_link'><a href="MyHelp/Modify.html#new-instance_method" title="MyHelp::Modify#new (method)">#new</a></span>
330
- <small>MyHelp::Modify</small>
348
+ <span class='object_link'><a href="MyHelp/CLI.html#new-instance_method" title="MyHelp::CLI#new (method)">#new</a></span>
349
+ <small>MyHelp::CLI</small>
331
350
  </div>
332
351
  </li>
333
352
 
@@ -356,6 +375,22 @@
356
375
  </li>
357
376
 
358
377
 
378
+ <li class="even ">
379
+ <div class="item">
380
+ <span class='object_link'><a href="MyHelp/List.html#pad_multi_bytes-instance_method" title="MyHelp::List#pad_multi_bytes (method)">#pad_multi_bytes</a></span>
381
+ <small>MyHelp::List</small>
382
+ </div>
383
+ </li>
384
+
385
+
386
+ <li class="odd ">
387
+ <div class="item">
388
+ <span class='object_link'><a href="MyHelp/CLI.html#place-instance_method" title="MyHelp::CLI#place (method)">#place</a></span>
389
+ <small>MyHelp::CLI</small>
390
+ </div>
391
+ </li>
392
+
393
+
359
394
  <li class="even ">
360
395
  <div class="item">
361
396
  <span class='object_link'><a href="MyHelp/Git.html#pull-instance_method" title="MyHelp::Git#pull (method)">#pull</a></span>
@@ -102,9 +102,9 @@
102
102
  </div>
103
103
 
104
104
  <div id="footer">
105
- Generated on Thu Sep 26 14:20:52 2024 by
105
+ Generated on Tue Oct 15 12:36:20 2024 by
106
106
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
107
- 0.9.36 (ruby-3.0.2).
107
+ 0.9.37 (ruby-3.0.2).
108
108
  </div>
109
109
 
110
110
  </div>
data/lib/my_help/cli.rb CHANGED
@@ -21,6 +21,19 @@ module MyHelp
21
21
  puts "my_help #{VERSION}"
22
22
  end
23
23
 
24
+ map "-s" => :search
25
+ desc "search [WORD]", "search word on my_helps dir"
26
+
27
+ def search(*args)
28
+ c = get_config
29
+ word = args[0]
30
+ targets = File.join(c[:local_help_dir],"*"+c[:ext])
31
+ puts "my_help search word on my_helps dir"
32
+ comm = "grep #{word} #{targets}"
33
+ puts "#{comm}\n\n"
34
+ system comm
35
+ end
36
+
24
37
  desc "git [pull|push]", "git operations"
25
38
  subcommand "git", Git
26
39
 
@@ -29,7 +29,7 @@ module MyHelp
29
29
  temp_path = File.expand_path("../templates", __dir__)
30
30
 
31
31
  if config[:template_dir] != temp_path
32
- puts "inconsistency for :template_dir"
32
+ puts "adjust inconsistency of template_dir.\n"
33
33
  config[:template_dir]= temp_path
34
34
  save_config
35
35
  end
data/lib/my_help/list.rb CHANGED
@@ -36,34 +36,49 @@ module MyHelp
36
36
  help_info = read_help(file)
37
37
  head = help_info[:items]["head"] ?
38
38
  help_info[:items]["head"].split("\n")[0] : ''
39
- # "head "ではだめ...やれやれ<24/10/02> revised
40
39
  # out << "%10s: %s\n" % [help_info[:name], head]
41
- # out << "%s: %s\n" % [help_info[:name], head]
42
- out << "%s: %s\n" % [pad_with_bytes(help_info[:name],20), head]
40
+ out << "%s: %s\n" %
41
+ [pad_multi_bytes(help_info[:name],20), head]
43
42
  end
44
43
  end
45
44
 
46
- def pad_with_bytes(str, length, padstr=" ")
47
- str_bytes = str.each_char.map do |c|
48
- c.bytesize == 1 ? 1 : 2
49
- end.reduce(0, &:+)
50
- pad = padstr * (length - str_bytes)
51
- return pad + str
52
- end
45
+ # def pad_multi_bytes(str, length, padstr=" ")
46
+ # str_bytes = str.each_char.map do |c|
47
+ # c.bytesize == 1 ? 1 : 2
48
+ # end.reduce(0, &:+)
49
+ # p [str, length, str_bytes]
50
+ # if str_bytes<length
51
+ # pad = padstr * (length - str_bytes)
52
+ # return pad + str
53
+ # else
54
+ # return str
55
+ # end
56
+ # end
57
+
58
+ def pad_multi_bytes(str, length, padstr=" ")
59
+ str_bytes = str.each_char.map { |c| c.bytesize == 1 ? 1 : 2 }.sum
60
+ pad_length = length - str_bytes
53
61
 
62
+ if pad_length > 0
63
+ pad = padstr * pad_length
64
+ return pad + str
65
+ else
66
+ return str
67
+ end
68
+ end
54
69
 
55
- # defaultで@path/name.@extのヘルプを読み込んで,itemを表示
56
- #
57
70
  def list_help_with(path, name, item)
58
71
  @help_info = read_help(path)
59
- output = ColorizedString["my_help called with name : #{name}, item : #{item}\n"].colorize(:cyan)
72
+ output = ColorizedString[
73
+ "my_help called with name : #{name},item : #{item}\n"
74
+ ].colorize(:cyan)
60
75
 
61
76
  if item == nil
62
77
  @help_info[:items].each_pair do |item, val|
63
78
  item, desc = item.split(":")
64
79
  desc ||= ""
65
- # output << "- %20s : %s\n" % [item, desc]
66
- output << "%s: %s\n" % [pad_with_bytes(item, 20), desc]
80
+ output << "%s: %s\n" %
81
+ [pad_multi_bytes(item, 20), desc]
67
82
  end
68
83
  else
69
84
  output << find_near(item)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MyHelp
4
- VERSION = "1.2.8"
4
+ VERSION = "1.2.10"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_help
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.8
4
+ version: 1.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shigeto R. Nishiani
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-03 00:00:00.000000000 Z
11
+ date: 2025-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  - !ruby/object:Gem::Version
188
188
  version: '0'
189
189
  requirements: []
190
- rubygems_version: 3.5.14
190
+ rubygems_version: 3.5.21
191
191
  signing_key:
192
192
  specification_version: 4
193
193
  summary: user building help