my_help 1.2.6 → 1.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/my_help/list.rb +18 -6
- data/lib/my_help/org2hash.rb +6 -1
- data/lib/my_help/version.rb +1 -1
- data/my_help.gemspec +3 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3194975e829d7fbb8daad82df834fd8a099a4aa5123be744a10fb60cc2cbf79f
|
4
|
+
data.tar.gz: 1e4023bdc4823e9c6c648412a380af584eb322fd1f5df73ed6f774db8fe247b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e76173eca3a142bf25d7d28b7867d038e131ca7f00650c36ca17abd3a98a0373759fcb3e348c9cedd426d5d43db4971ead8837e950eea3a0e34a0443bbe8db2
|
7
|
+
data.tar.gz: 489b68bc28669f05bff539f3cc34fef7b5df7554b898506c96f8039138fd357e398b68e5dcd85e650e81f6633d248f57f94627891d521fb324ef2cc4c8030aa0
|
data/lib/my_help/list.rb
CHANGED
@@ -16,7 +16,7 @@ module MyHelp
|
|
16
16
|
if item == nil && name == nil
|
17
17
|
list_helps()
|
18
18
|
else
|
19
|
-
path = File.
|
19
|
+
path = File.exist?(name + @ext) ? name + @ext :
|
20
20
|
File.join(@path, name + @ext)
|
21
21
|
list_help_with(path, name, item)
|
22
22
|
end
|
@@ -32,15 +32,26 @@ module MyHelp
|
|
32
32
|
def list_helps()
|
33
33
|
files = File.join(@path, "*#{@ext}")
|
34
34
|
Dir.glob(files).inject("") do |out, file|
|
35
|
-
|
35
|
+
# p [out, file]
|
36
36
|
help_info = read_help(file)
|
37
37
|
head = help_info[:items]["head"] ?
|
38
|
-
help_info[:items]["head"].split("\n")[0] :
|
39
|
-
|
40
|
-
out << "%10s: %s\n" % [help_info[:name], head]
|
38
|
+
help_info[:items]["head"].split("\n")[0] : ''
|
39
|
+
# "head "ではだめ...やれやれ<24/10/02> revised
|
40
|
+
# 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]
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
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
|
53
|
+
|
54
|
+
|
44
55
|
# defaultで@path/name.@extのヘルプを読み込んで,itemを表示
|
45
56
|
#
|
46
57
|
def list_help_with(path, name, item)
|
@@ -51,7 +62,8 @@ module MyHelp
|
|
51
62
|
@help_info[:items].each_pair do |item, val|
|
52
63
|
item, desc = item.split(":")
|
53
64
|
desc ||= ""
|
54
|
-
output << "- %20s : %s\n" % [item, desc]
|
65
|
+
# output << "- %20s : %s\n" % [item, desc]
|
66
|
+
output << "%s: %s\n" % [pad_with_bytes(item, 20), desc]
|
55
67
|
end
|
56
68
|
else
|
57
69
|
output << find_near(item)
|
data/lib/my_help/org2hash.rb
CHANGED
data/lib/my_help/version.rb
CHANGED
data/my_help.gemspec
CHANGED
@@ -23,7 +23,9 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_runtime_dependency "thor"
|
24
24
|
spec.add_runtime_dependency "command_line"
|
25
25
|
spec.add_runtime_dependency "colorize"
|
26
|
-
spec.add_development_dependency "aruba"
|
26
|
+
# spec.add_development_dependency "aruba"
|
27
|
+
spec.add_development_dependency "yard"
|
28
|
+
spec.add_development_dependency "rubocop"
|
27
29
|
# For more information and examples about making a new gem, checkout our
|
28
30
|
# guide at: https://bundler.io/guides/creating_gem.html
|
29
31
|
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.
|
4
|
+
version: 1.2.8
|
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-
|
11
|
+
date: 2024-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -67,7 +67,21 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: yard
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - ">="
|