benry-cmdapp 1.1.0 → 1.1.1

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: 93ac71b6b3c1d20a3b3fda343372b791c284e77e3a1b475ff9ac6a7c6adec123
4
- data.tar.gz: 01a0568d79c5e94c4be53aaa9eb0766406a695c55b4c2c11222cf1c396700b87
3
+ metadata.gz: dd749bd655750efee168dacda0d1f2609548a31fff1dd2c9d53e323c0fad145b
4
+ data.tar.gz: a3484ad1a239396af73c7173ac7272ac156d2e424b2a4d90f732cd1e1196bf95
5
5
  SHA512:
6
- metadata.gz: 71a365339d5b71b5acb46558e116991fcce7c900261b98b15dddeb50ba4fa7d50b7b6e278b22db4b3413fb171432f92369a0860df86c484b35fca8aacbb76bc3
7
- data.tar.gz: e795e95e65f1c50f3ba7123f050747f8c504f1b233839df775c8451b33983f7da5ca7829df7b6854a1e17ea6b410c336829d023a4b5659bb19b1725c66345d97
6
+ metadata.gz: 8ede7e8ca3b150642c064343ec3a310164986595a313e97a9e96cb7766fa6b5725102f482a40edfcfa3edafdea681cf58459d8845fa4b0622716e709dfe07024
7
+ data.tar.gz: 87a6c333685eb856704c37c62692a177384dae41475a55402904cd4d3c24d1dcfde8211e8df5d7718ec981e5a452b61f1d02894f7ed47671e13b71fb930f3a20
data/CHANGES.md CHANGED
@@ -2,6 +2,12 @@ CHANGES
2
2
  =======
3
3
 
4
4
 
5
+ Release 1.1.1 (2023-12-29)
6
+ --------------------------
7
+
8
+ * [bugfix] Fix to print method parameter 'foo_' as 'foo' in help message.
9
+
10
+
5
11
  Release 1.1.0 (2023-12-04)
6
12
  --------------------------
7
13
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Benry-CmdApp
2
2
 
3
- ($Release: 1.1.0 $)
3
+ ($Release: 1.1.1 $)
4
4
 
5
5
 
6
6
  ## What's This?
data/benry-cmdapp.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "benry-cmdapp"
5
- spec.version = "$Release: 1.1.0 $".split()[1]
5
+ spec.version = "$Release: 1.1.1 $".split()[1]
6
6
  spec.author = "kwatch"
7
7
  spec.email = "kwatch@gmail.com"
8
8
  spec.platform = Gem::Platform::RUBY
@@ -21,7 +21,7 @@
21
21
  <ul class="nav">
22
22
  </ul>
23
23
  </nav>
24
- <p>($Release: 1.1.0 $)</p>
24
+ <p>($Release: 1.1.1 $)</p>
25
25
  <section class="section" id="whats-this">
26
26
  <h2>What's This?</h2>
27
27
  <p>Benry-CmdApp is a framework to create command-line application.
data/lib/benry/cmdapp.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  ###
5
- ### $Release: 1.1.0 $
5
+ ### $Release: 1.1.1 $
6
6
  ### $Copyright: copyright(c) 2023 kwatch@gmail.com $
7
7
  ### $License: MIT License $
8
8
  ###
@@ -91,18 +91,22 @@ module Benry::CmdApp
91
91
  sb << ("]" * n) if n > 0
92
92
  #; [!mbxy5] converts `.foo(x, *x_)` into `' <x>...'`.
93
93
  #; [!mh9ni] converts `.foo(x, *x2)` into `' <x>...'`.
94
- return sb.join().sub(/<([^>]+)> \[<\1[-_2]>\.\.\.\]/, "<\\1>...")
94
+ return sb.join().sub(/<([^>]+)> \[<\1[-_2]?>\.\.\.\]/, "<\\1>...")
95
95
  end
96
96
 
97
97
  def param2arg(param)
98
98
  #; [!ahvsn] converts parameter name (Symbol) into argument name (String).
99
99
  #; [!27dpw] converts `:aa_or_bb_or_cc` into `'aa|bb|cc'`.
100
100
  #; [!to41h] converts `:aa__bb__cc` into `'aa.bb.cc'`.
101
+ #; [!cldax] converts `:aa_` into `'aa'`.
101
102
  #; [!2ma08] converts `:aa_bb_cc` into `'aa-bb-cc'`.
103
+ #; [!5d0qf] lefts `:_aa` as `'_aa'`.
102
104
  s = param.to_s
103
105
  s = s.gsub('_or_', '|') # ex: 'file_or_dir' => 'file|dir'
104
106
  s = s.gsub('__' , '.') # ex: 'file__html' => 'file.html'
107
+ s = s.gsub(/_+\z/, '') # ex: 'end_' => 'end'
105
108
  s = s.gsub('_' , '-') # ex: 'foo_bar_baz' => 'foo-bar-baz'
109
+ s = s.gsub(/\A-/ , '_') # ex: '-aa' => '_aa'
106
110
  return s
107
111
  end
108
112
 
data/test/util_test.rb CHANGED
@@ -109,10 +109,18 @@ Oktest.scope do
109
109
  ok {Benry::CmdApp::Util.param2arg(:aa__bb__cc)} == "aa.bb.cc"
110
110
  end
111
111
 
112
+ spec "[!cldax] converts `:aa_` into `'aa'`." do
113
+ ok {Benry::CmdApp::Util.param2arg(:aa_)} == "aa"
114
+ end
115
+
112
116
  spec "[!2ma08] converts `:aa_bb_cc` into `'aa-bb-cc'`." do
113
117
  ok {Benry::CmdApp::Util.param2arg(:aa_bb_cc)} == "aa-bb-cc"
114
118
  end
115
119
 
120
+ spec "[!5d0qf] lefts `:_aa` as `'_aa'`." do
121
+ ok {Benry::CmdApp::Util.param2arg(:_aa_bb_cc_)} == "_aa-bb-cc"
122
+ end
123
+
116
124
  end
117
125
 
118
126
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benry-cmdapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kwatch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-04 00:00:00.000000000 Z
11
+ date: 2023-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benry-cmdopt