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 +4 -4
- data/CHANGES.md +6 -0
- data/README.md +1 -1
- data/benry-cmdapp.gemspec +1 -1
- data/doc/benry-cmdapp.html +1 -1
- data/lib/benry/cmdapp.rb +6 -2
- data/test/util_test.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd749bd655750efee168dacda0d1f2609548a31fff1dd2c9d53e323c0fad145b
|
4
|
+
data.tar.gz: a3484ad1a239396af73c7173ac7272ac156d2e424b2a4d90f732cd1e1196bf95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ede7e8ca3b150642c064343ec3a310164986595a313e97a9e96cb7766fa6b5725102f482a40edfcfa3edafdea681cf58459d8845fa4b0622716e709dfe07024
|
7
|
+
data.tar.gz: 87a6c333685eb856704c37c62692a177384dae41475a55402904cd4d3c24d1dcfde8211e8df5d7718ec981e5a452b61f1d02894f7ed47671e13b71fb930f3a20
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
data/benry-cmdapp.gemspec
CHANGED
data/doc/benry-cmdapp.html
CHANGED
data/lib/benry/cmdapp.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
###
|
5
|
-
### $Release: 1.1.
|
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]
|
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.
|
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-
|
11
|
+
date: 2023-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benry-cmdopt
|