my_help 1.2.6 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be2722814aac663f8eee3f893e414655b4ff7ce165ef3bb6ed66f39701bad9e3
4
- data.tar.gz: c1981f69301b87f72940108c6de17366cb28993ce2bcd46467cf336a2f9e3d77
3
+ metadata.gz: cb657df4836581b1f682cf5cffabdb89215f4f6f51a5836aa2dfdb7d86d11a20
4
+ data.tar.gz: 8e2d7673d363db127caeba1323837a7a2a1ef989f25461ec0dd28ee33f594d7c
5
5
  SHA512:
6
- metadata.gz: 4602fc0552133a2886b66304aee211172f3b369a0032c0b7d5824ca27bc1ff3d5c4f2efbb645165406980ce15802dfaa1a0c7969f6dda8842e707ab34a10de45
7
- data.tar.gz: a3b1adcce95d4c61255ca50390754d9e07328024e39b5e69f0d4d298ece483a9fff85db9dd3cb4f924849f807449d7cb8bdd4944ab3e306062ff59c3a4f56e18
6
+ metadata.gz: 41f84a96ab9e2b1794805587c13c14489e3e85f849d756875e0f1a0bf0fe780db5e009adebbac32efa0b85ce1209e21d8b4d54d4ebe546c2edfd590b4d789f49
7
+ data.tar.gz: 3309a3cfd356061482fae41107396fb9a319e0b9a6bc4dd2e98fa88048ed044f2f2c29a37aadfc3ed9f8e9acb32cba2724e29cff09f3eedbd6d33af7702ec661
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.exists?(name + @ext) ? name + @ext :
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,27 @@ module MyHelp
32
32
  def list_helps()
33
33
  files = File.join(@path, "*#{@ext}")
34
34
  Dir.glob(files).inject("") do |out, file|
35
- # p [out, file]
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
- ''
38
+ help_info[:items]["head"].split("\n")[0] : ''
39
+ # "head "ではだめ...やれやれ<24/10/02> revised
40
40
  out << "%10s: %s\n" % [help_info[:name], head]
41
+ # out << "%s: %s\n" % [help_info[:name], head]
42
+ # out << "%20s: %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
+ p str="日本語"
48
+ p str_bytes = str.bytesize
49
+ p pad_bytes = length - str_bytes
50
+ p pad = padstr * (pad_bytes / padstr.bytesize)
51
+ exit
52
+ return pad + str
53
+ end
54
+
55
+
44
56
  # defaultで@path/name.@extのヘルプを読み込んで,itemを表示
45
57
  #
46
58
  def list_help_with(path, name, item)
@@ -52,6 +64,7 @@ module MyHelp
52
64
  item, desc = item.split(":")
53
65
  desc ||= ""
54
66
  output << "- %20s : %s\n" % [item, desc]
67
+ # output << "%s: %s\n" % [pad_with_bytes(item, 40), desc]
55
68
  end
56
69
  else
57
70
  output << find_near(item)
@@ -40,7 +40,12 @@ module MyHelp
40
40
 
41
41
  def read_item(line)
42
42
  m = line.match(/\* (.+)/)
43
- return m ? m[1] : nil
43
+ item = if m
44
+ m[1].match(/head\s*/) ? "head" : m[1]
45
+ else
46
+ nil
47
+ end
48
+ return item
44
49
  end
45
50
  end
46
51
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MyHelp
4
- VERSION = "1.2.6"
4
+ VERSION = "1.2.7"
5
5
  end
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.6
4
+ version: 1.2.7
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-09-30 00:00:00.000000000 Z
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: aruba
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
  - - ">="