cmdlet 0.7.1 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.builders/data/categories.json +8 -8
- data/.builders/data/cmdlets/case.json +1 -40
- data/.builders/data/cmdlets/misc.json +30 -0
- data/.builders/data/cmdlets/str.json +44 -0
- data/.builders/generators/20-categories.rb +3 -3
- data/.builders/generators/cmdlets/case.rb +1 -0
- data/.builders/generators/cmdlets/misc.rb +22 -0
- data/.builders/generators/cmdlets/str.rb +29 -0
- data/CHANGELOG.md +21 -0
- data/lib/cmdlet/_.rb +2 -0
- data/lib/cmdlet/configuration.rb +5 -0
- data/lib/cmdlet/misc/safe.rb +17 -0
- data/lib/cmdlet/str/padl.rb +22 -0
- data/lib/cmdlet/version.rb +1 -1
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79e91578d58c0b0e5a4a6f51c264829725206dc03bc40084d6bfd351fbeb090d
|
4
|
+
data.tar.gz: 5d1e4125f4c8af9181f9e95a290a3ec318bfd467ac5c2df1e23368605759aaf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae396b1f26a8efd340c97441419da17874ba399353b1b4f28c67e85eeb24125583ab5ce259c93d2e4c9ac9b90fd30f7398e4e5412ae47e3ff1c0c7505ef26069
|
7
|
+
data.tar.gz: 341a899ec35708b877ee4b9e6644fdea4e9713bdb181e5582e67ed8d956d55a885eee79b20dc98095a752860d7816133ac264b7021499730a9c43b570fbc5d29
|
@@ -1,5 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"categories": [
|
3
|
+
{
|
4
|
+
"name": "array",
|
5
|
+
"description": "Array handling routines, eg. join, join_prefix, join_post"
|
6
|
+
},
|
3
7
|
{
|
4
8
|
"name": "case",
|
5
9
|
"description": "Tokenize and apply case and/or separator"
|
@@ -13,16 +17,12 @@
|
|
13
17
|
"description": "Inflection handling routines, eg. pluralize, singular, ordinalize"
|
14
18
|
},
|
15
19
|
{
|
16
|
-
"name": "
|
17
|
-
"description": "
|
20
|
+
"name": "misc",
|
21
|
+
"description": "Miscellaneous cmdlets"
|
18
22
|
},
|
19
23
|
{
|
20
|
-
"name": "
|
21
|
-
"description": "
|
22
|
-
},
|
23
|
-
{
|
24
|
-
"name": "transform",
|
25
|
-
"description": "Tokenize and apply case and/or separator"
|
24
|
+
"name": "str",
|
25
|
+
"description": "String manipulation"
|
26
26
|
}
|
27
27
|
]
|
28
28
|
}
|
@@ -6,9 +6,6 @@
|
|
6
6
|
"aliases": [
|
7
7
|
"backward_slash",
|
8
8
|
"slash_backward"
|
9
|
-
],
|
10
|
-
"name_and_aliases": [
|
11
|
-
|
12
9
|
],
|
13
10
|
"description": "Convert to back slash notation",
|
14
11
|
"result": "value converted to back_slash case",
|
@@ -37,9 +34,6 @@
|
|
37
34
|
"camelUpper",
|
38
35
|
"camelU",
|
39
36
|
"pascalcase"
|
40
|
-
],
|
41
|
-
"name_and_aliases": [
|
42
|
-
|
43
37
|
],
|
44
38
|
"description": "Camel case the characters in the given 'string'",
|
45
39
|
"result": "value converted to camel case",
|
@@ -65,9 +59,6 @@
|
|
65
59
|
"name": "constant",
|
66
60
|
"aliases": [
|
67
61
|
"constantize"
|
68
|
-
],
|
69
|
-
"name_and_aliases": [
|
70
|
-
|
71
62
|
],
|
72
63
|
"description": "Constant case the characters in the given 'string'",
|
73
64
|
"result": "value converted to constant case",
|
@@ -96,9 +87,6 @@
|
|
96
87
|
"dashify",
|
97
88
|
"dashcase",
|
98
89
|
"hyphenate"
|
99
|
-
],
|
100
|
-
"name_and_aliases": [
|
101
|
-
|
102
90
|
],
|
103
91
|
"description": "Dash case the characters in the given 'string'",
|
104
92
|
"result": "value converted to dash case",
|
@@ -127,9 +115,6 @@
|
|
127
115
|
"dotify",
|
128
116
|
"dotcase",
|
129
117
|
"hyphenate"
|
130
|
-
],
|
131
|
-
"name_and_aliases": [
|
132
|
-
|
133
118
|
],
|
134
119
|
"description": "Dot case the characters in the given 'string'",
|
135
120
|
"result": "value converted to dot case",
|
@@ -155,9 +140,6 @@
|
|
155
140
|
"name": "double_colon",
|
156
141
|
"aliases": [
|
157
142
|
|
158
|
-
],
|
159
|
-
"name_and_aliases": [
|
160
|
-
|
161
143
|
],
|
162
144
|
"description": "Double colon case the characters in the given 'string'",
|
163
145
|
"result": "value converted to double_colon case",
|
@@ -184,9 +166,6 @@
|
|
184
166
|
"aliases": [
|
185
167
|
"humanize",
|
186
168
|
"sentence"
|
187
|
-
],
|
188
|
-
"name_and_aliases": [
|
189
|
-
|
190
169
|
],
|
191
170
|
"description": "Human case the characters in the given 'string'",
|
192
171
|
"result": "value converted to human case",
|
@@ -214,9 +193,6 @@
|
|
214
193
|
"camel_lower",
|
215
194
|
"camelLower",
|
216
195
|
"camelL"
|
217
|
-
],
|
218
|
-
"name_and_aliases": [
|
219
|
-
|
220
196
|
],
|
221
197
|
"description": "Lower camel case the characters in the given 'string'",
|
222
198
|
"result": "value converted to lower camel case",
|
@@ -243,9 +219,6 @@
|
|
243
219
|
"aliases": [
|
244
220
|
"lowercase",
|
245
221
|
"downcase"
|
246
|
-
],
|
247
|
-
"name_and_aliases": [
|
248
|
-
|
249
222
|
],
|
250
223
|
"description": "Lower case the characters in the given 'string'",
|
251
224
|
"result": "value converted to lower case",
|
@@ -272,9 +245,6 @@
|
|
272
245
|
"aliases": [
|
273
246
|
"forward_slash",
|
274
247
|
"slash_forward"
|
275
|
-
],
|
276
|
-
"name_and_aliases": [
|
277
|
-
|
278
248
|
],
|
279
249
|
"description": "Slash case the characters in the given 'string'",
|
280
250
|
"result": "value converted to slash case",
|
@@ -300,9 +270,6 @@
|
|
300
270
|
"name": "snake",
|
301
271
|
"aliases": [
|
302
272
|
|
303
|
-
],
|
304
|
-
"name_and_aliases": [
|
305
|
-
|
306
273
|
],
|
307
274
|
"description": "Snake case the characters in the given 'string'",
|
308
275
|
"result": "value converted to snake case",
|
@@ -327,10 +294,7 @@
|
|
327
294
|
{
|
328
295
|
"name": "title",
|
329
296
|
"aliases": [
|
330
|
-
|
331
|
-
],
|
332
|
-
"name_and_aliases": [
|
333
|
-
|
297
|
+
"titleize"
|
334
298
|
],
|
335
299
|
"description": "Title case the characters in the given 'string'",
|
336
300
|
"result": "value converted to title case",
|
@@ -357,9 +321,6 @@
|
|
357
321
|
"aliases": [
|
358
322
|
"upcase",
|
359
323
|
"uppercase"
|
360
|
-
],
|
361
|
-
"name_and_aliases": [
|
362
|
-
|
363
324
|
],
|
364
325
|
"description": "Upper case the characters in the given 'string'",
|
365
326
|
"result": "value converted to upper case",
|
@@ -0,0 +1,30 @@
|
|
1
|
+
{
|
2
|
+
"category_key": "misc",
|
3
|
+
"cmdlets": [
|
4
|
+
{
|
5
|
+
"name": "safe",
|
6
|
+
"aliases": [
|
7
|
+
|
8
|
+
],
|
9
|
+
"description": "pass through the value with <> and single and double quotes left as is",
|
10
|
+
"result": "the value with <> and single and double quotes left as is",
|
11
|
+
"category": "misc",
|
12
|
+
"category_description": "Miscellaneous cmdlets",
|
13
|
+
"base_class_require": null,
|
14
|
+
"base_class": null,
|
15
|
+
"parameters": [
|
16
|
+
{
|
17
|
+
"name": "value",
|
18
|
+
"description": "value to pass through",
|
19
|
+
"splat": null,
|
20
|
+
"default": null,
|
21
|
+
"param_type": "String|Int"
|
22
|
+
}
|
23
|
+
],
|
24
|
+
"examples": [
|
25
|
+
|
26
|
+
],
|
27
|
+
"ruby": " value = '' if value.nil?\n value\n"
|
28
|
+
}
|
29
|
+
]
|
30
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
{
|
2
|
+
"category_key": "str",
|
3
|
+
"cmdlets": [
|
4
|
+
{
|
5
|
+
"name": "padl",
|
6
|
+
"aliases": [
|
7
|
+
|
8
|
+
],
|
9
|
+
"description": "pass through the value with <> and single and double quotes left as is",
|
10
|
+
"result": "the value with <> and single and double quotes left as is",
|
11
|
+
"category": "str",
|
12
|
+
"category_description": "String manipulation",
|
13
|
+
"base_class_require": null,
|
14
|
+
"base_class": null,
|
15
|
+
"parameters": [
|
16
|
+
{
|
17
|
+
"name": "value",
|
18
|
+
"description": "value to apply padding to",
|
19
|
+
"splat": null,
|
20
|
+
"default": null,
|
21
|
+
"param_type": "String|Symbol|Int"
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"name": "count",
|
25
|
+
"description": "how much padding to apply. defaults to configuration.padl_count",
|
26
|
+
"splat": null,
|
27
|
+
"default": null,
|
28
|
+
"param_type": "Int"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"name": "char",
|
32
|
+
"description": "character to pad with. defaults to configuration.padl_char",
|
33
|
+
"splat": null,
|
34
|
+
"default": null,
|
35
|
+
"param_type": "String"
|
36
|
+
}
|
37
|
+
],
|
38
|
+
"examples": [
|
39
|
+
|
40
|
+
],
|
41
|
+
"ruby": " value = '' if value.nil?\n # count = Handlebars::Helpers.configuration.padl_count if count.nil?\n count = 30 if count.nil?\n count = count.to_i if count.is_a?(String)\n # char = Handlebars::Helpers.configuration.padl_char if char.nil?\n char = ' ' if char.nil?\n value.to_s.rjust(count, char)\n"
|
42
|
+
}
|
43
|
+
]
|
44
|
+
}
|
@@ -4,12 +4,12 @@ KManager.action :categories do
|
|
4
4
|
action do
|
5
5
|
CategoryDirector
|
6
6
|
.init(k_builder)
|
7
|
+
.category(:array , 'Array handling routines, eg. join, join_prefix, join_post')
|
7
8
|
.category(:case , 'Tokenize and apply case and/or separator')
|
8
9
|
.category(:comparison , 'Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.')
|
9
10
|
.category(:inflection , 'Inflection handling routines, eg. pluralize, singular, ordinalize')
|
10
|
-
.category(:
|
11
|
-
.category(:
|
12
|
-
.category(:transform , 'Tokenize and apply case and/or separator')
|
11
|
+
.category(:misc , 'Miscellaneous cmdlets')
|
12
|
+
.category(:str , 'String manipulation')
|
13
13
|
.save_categories
|
14
14
|
.generate
|
15
15
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
KManager.action :misc_commands do
|
4
|
+
action do
|
5
|
+
CmdletDirector
|
6
|
+
.init(k_builder, category: :misc)
|
7
|
+
.cmdlet do
|
8
|
+
name :safe
|
9
|
+
description 'pass through the value with <> and single and double quotes left as is'
|
10
|
+
result 'the value with <> and single and double quotes left as is'
|
11
|
+
|
12
|
+
parameter :value, 'value to pass through', param_type: 'String|Int'
|
13
|
+
|
14
|
+
ruby <<-RUBY
|
15
|
+
value = '' if value.nil?
|
16
|
+
value
|
17
|
+
RUBY
|
18
|
+
end
|
19
|
+
.generate
|
20
|
+
# .debug
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
KManager.action :string_commands do
|
4
|
+
action do
|
5
|
+
CmdletDirector
|
6
|
+
.init(k_builder, category: :str)
|
7
|
+
.cmdlet do
|
8
|
+
name :padl
|
9
|
+
description 'pass through the value with <> and single and double quotes left as is'
|
10
|
+
result 'the value with <> and single and double quotes left as is'
|
11
|
+
|
12
|
+
parameter :value, 'value to apply padding to', param_type: 'String|Symbol|Int'
|
13
|
+
parameter :count, 'how much padding to apply. defaults to configuration.padl_count', param_type: 'Int'
|
14
|
+
parameter :char , 'character to pad with. defaults to configuration.padl_char', param_type: 'String'
|
15
|
+
|
16
|
+
ruby <<-RUBY
|
17
|
+
value = '' if value.nil?
|
18
|
+
# count = Handlebars::Helpers.configuration.padl_count if count.nil?
|
19
|
+
count = 30 if count.nil?
|
20
|
+
count = count.to_i if count.is_a?(String)
|
21
|
+
# char = Handlebars::Helpers.configuration.padl_char if char.nil?
|
22
|
+
char = ' ' if char.nil?
|
23
|
+
value.to_s.rjust(count, char)
|
24
|
+
RUBY
|
25
|
+
end
|
26
|
+
.generate
|
27
|
+
# .debug
|
28
|
+
end
|
29
|
+
end
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
# [0.9.0](https://github.com/klueless-io/cmdlet/compare/v0.8.0...v0.9.0) (2022-07-16)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* add safe support ([df784a2](https://github.com/klueless-io/cmdlet/commit/df784a2ce0b95fd46b6a2d10f55d858afa377fe3))
|
7
|
+
|
8
|
+
# [0.8.0](https://github.com/klueless-io/cmdlet/compare/v0.7.1...v0.8.0) (2022-07-15)
|
9
|
+
|
10
|
+
|
11
|
+
### Features
|
12
|
+
|
13
|
+
* add misc: :safe ([3a24c37](https://github.com/klueless-io/cmdlet/commit/3a24c3796b478164a4e36486d4619396a84880b9))
|
14
|
+
|
15
|
+
## [0.7.1](https://github.com/klueless-io/cmdlet/compare/v0.7.0...v0.7.1) (2022-07-15)
|
16
|
+
|
17
|
+
|
18
|
+
### Bug Fixes
|
19
|
+
|
20
|
+
* add alias support ([c26a092](https://github.com/klueless-io/cmdlet/commit/c26a092d2c5fdf49ae6b1ebb017f4a6e4399a499))
|
21
|
+
|
1
22
|
# [0.7.0](https://github.com/klueless-io/cmdlet/compare/v0.6.2...v0.7.0) (2022-07-14)
|
2
23
|
|
3
24
|
|
data/lib/cmdlet/_.rb
CHANGED
data/lib/cmdlet/configuration.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Miscellaneous cmdlets
|
5
|
+
module Misc
|
6
|
+
# Safe: pass through the value with <> and single and double quotes left as is
|
7
|
+
class Safe < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [String|Int] value - value to pass through
|
10
|
+
# @return [String] the value with <> and single and double quotes left as is
|
11
|
+
def call(value)
|
12
|
+
value = '' if value.nil?
|
13
|
+
value
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# String manipulation
|
5
|
+
module Str
|
6
|
+
# Padl: pass through the value with <> and single and double quotes left as is
|
7
|
+
class Padl < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [String|Symbol|Int] value - value to apply padding to
|
10
|
+
# @param [Int] count - how much padding to apply. defaults to configuration.padl_count
|
11
|
+
# @param [String] char - character to pad with. defaults to configuration.padl_char
|
12
|
+
# @return [String] the value with <> and single and double quotes left as is
|
13
|
+
def call(value, count = nil, char = nil)
|
14
|
+
value = '' if value.nil?
|
15
|
+
count = KConfig.configuration.cmdlet.padl_count if count.nil?
|
16
|
+
count = count.to_i if count.is_a?(String)
|
17
|
+
char = KConfig.configuration.cmdlet.padl_char if char.nil?
|
18
|
+
value.to_s.rjust(count, char)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/cmdlet/version.rb
CHANGED
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "cmdlet",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.9.1",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "cmdlet",
|
9
|
-
"version": "0.
|
9
|
+
"version": "0.9.1",
|
10
10
|
"devDependencies": {
|
11
11
|
"@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
|
12
12
|
"@semantic-release/changelog": "^6.0.1",
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmdlet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -61,6 +61,8 @@ files:
|
|
61
61
|
- ".builders/data/cmdlets/case.json"
|
62
62
|
- ".builders/data/cmdlets/comparison.json"
|
63
63
|
- ".builders/data/cmdlets/inflection.json"
|
64
|
+
- ".builders/data/cmdlets/misc.json"
|
65
|
+
- ".builders/data/cmdlets/str.json"
|
64
66
|
- ".builders/director/category_builder.rb"
|
65
67
|
- ".builders/director/category_dao.rb"
|
66
68
|
- ".builders/director/category_director.rb"
|
@@ -77,6 +79,8 @@ files:
|
|
77
79
|
- ".builders/generators/cmdlets/case.rb"
|
78
80
|
- ".builders/generators/cmdlets/comparison.rb"
|
79
81
|
- ".builders/generators/cmdlets/inflection.rb"
|
82
|
+
- ".builders/generators/cmdlets/misc.rb"
|
83
|
+
- ".builders/generators/cmdlets/str.rb"
|
80
84
|
- ".releaserc.json"
|
81
85
|
- ".rspec"
|
82
86
|
- ".rubocop.yml"
|
@@ -125,6 +129,8 @@ files:
|
|
125
129
|
- lib/cmdlet/inflection/pluralize_number.rb
|
126
130
|
- lib/cmdlet/inflection/pluralize_number_word.rb
|
127
131
|
- lib/cmdlet/inflection/singularize.rb
|
132
|
+
- lib/cmdlet/misc/safe.rb
|
133
|
+
- lib/cmdlet/str/padl.rb
|
128
134
|
- lib/cmdlet/string_tokenizer.rb
|
129
135
|
- lib/cmdlet/version.rb
|
130
136
|
- package-lock.json
|