cmdlet 0.9.2 → 0.10.0
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/cmdlets/str.json +43 -4
- data/.builders/generators/cmdlets/str.rb +26 -11
- data/CHANGELOG.md +7 -0
- data/lib/cmdlet/_.rb +1 -0
- data/lib/cmdlet/str/padl.rb +2 -2
- data/lib/cmdlet/str/padr.rb +22 -0
- data/lib/cmdlet/version.rb +1 -1
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 838f77f0abbcd638881e7172b1b51de493642ed08759d260bd19ec53f57cfa2c
|
4
|
+
data.tar.gz: 28b1aebad3a1ab88af71dd69c0bfbaf4925af1b5d3ed9ebebe853cc74612b518
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca04fe9945aef2e6a74074cf1667aa6bac38599323ec575e947a0fb04f917fe583a975912ad0fe7ae38577dde1cfcb8db4f876f2ecab5f0b9804b1beb3409677
|
7
|
+
data.tar.gz: 48158ed2c3f7d91764361ce27764809689049f3606a534e212cd360b7469eec939262c3221339e305a3a67870f8b38baa64c4a41423dec62217938eea6209a64
|
@@ -6,8 +6,8 @@
|
|
6
6
|
"aliases": [
|
7
7
|
|
8
8
|
],
|
9
|
-
"description": "
|
10
|
-
"result": "the value with
|
9
|
+
"description": "take the value and give it padding on the left hand side",
|
10
|
+
"result": "the value padded on LHS with [char (default ' ')] and [count (default 30)]",
|
11
11
|
"category": "str",
|
12
12
|
"category_description": "String manipulation",
|
13
13
|
"base_class_require": null,
|
@@ -24,21 +24,60 @@
|
|
24
24
|
"name": "count",
|
25
25
|
"description": "how much padding to apply. defaults to configuration.padl_count",
|
26
26
|
"splat": null,
|
27
|
-
"default":
|
27
|
+
"default": "nil",
|
28
28
|
"param_type": "Int"
|
29
29
|
},
|
30
30
|
{
|
31
31
|
"name": "char",
|
32
32
|
"description": "character to pad with. defaults to configuration.padl_char",
|
33
33
|
"splat": null,
|
34
|
+
"default": "nil",
|
35
|
+
"param_type": "String"
|
36
|
+
}
|
37
|
+
],
|
38
|
+
"examples": [
|
39
|
+
|
40
|
+
],
|
41
|
+
"ruby": " value = '' if value.nil?\n count = KConfig.configuration.cmdlet.padl_count if count.nil?\n count = count.to_i if count.is_a?(String)\n char = KConfig.configuration.cmdlet.padl_char if char.nil?\n value.to_s.rjust(count, char)\n"
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"name": "padr",
|
45
|
+
"aliases": [
|
46
|
+
|
47
|
+
],
|
48
|
+
"description": "take the value and give it padding on the right hand side",
|
49
|
+
"result": "the value padded on RHS with [char (default ' ')] and [count (default 30)]",
|
50
|
+
"category": "str",
|
51
|
+
"category_description": "String manipulation",
|
52
|
+
"base_class_require": null,
|
53
|
+
"base_class": null,
|
54
|
+
"parameters": [
|
55
|
+
{
|
56
|
+
"name": "value",
|
57
|
+
"description": "value to apply padding to",
|
58
|
+
"splat": null,
|
34
59
|
"default": null,
|
60
|
+
"param_type": "String|Symbol|Int"
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"name": "count",
|
64
|
+
"description": "how much padding to apply. defaults to configuration.padr_count",
|
65
|
+
"splat": null,
|
66
|
+
"default": "nil",
|
67
|
+
"param_type": "Int"
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"name": "char",
|
71
|
+
"description": "character to pad with. defaults to configuration.padr_char",
|
72
|
+
"splat": null,
|
73
|
+
"default": "nil",
|
35
74
|
"param_type": "String"
|
36
75
|
}
|
37
76
|
],
|
38
77
|
"examples": [
|
39
78
|
|
40
79
|
],
|
41
|
-
"ruby": "
|
80
|
+
"ruby": " value = '' if value.nil?\n count = KConfig.configuration.cmdlet.padr_count if count.nil?\n count = count.to_i if count.is_a?(String)\n char = KConfig.configuration.cmdlet.padr_char if char.nil?\n value.to_s.ljust(count, char)\n"
|
42
81
|
}
|
43
82
|
]
|
44
83
|
}
|
@@ -6,21 +6,36 @@ KManager.action :string_commands do
|
|
6
6
|
.init(k_builder, category: :str)
|
7
7
|
.cmdlet do
|
8
8
|
name :padl
|
9
|
-
description '
|
10
|
-
result
|
9
|
+
description 'take the value and give it padding on the left hand side'
|
10
|
+
result "the value padded on LHS with [char (default ' ')] and [count (default 30)]"
|
11
11
|
|
12
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'
|
13
|
+
parameter :count, 'how much padding to apply. defaults to configuration.padl_count', param_type: 'Int', default: 'nil'
|
14
|
+
parameter :char , 'character to pad with. defaults to configuration.padl_char', param_type: 'String', default: 'nil'
|
15
15
|
|
16
16
|
ruby <<-RUBY
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
value = '' if value.nil?
|
18
|
+
count = KConfig.configuration.cmdlet.padl_count if count.nil?
|
19
|
+
count = count.to_i if count.is_a?(String)
|
20
|
+
char = KConfig.configuration.cmdlet.padl_char if char.nil?
|
21
|
+
value.to_s.rjust(count, char)
|
22
|
+
RUBY
|
23
|
+
end
|
24
|
+
.cmdlet do
|
25
|
+
name :padr
|
26
|
+
description 'take the value and give it padding on the right hand side'
|
27
|
+
result "the value padded on RHS with [char (default ' ')] and [count (default 30)]"
|
28
|
+
|
29
|
+
parameter :value, 'value to apply padding to', param_type: 'String|Symbol|Int'
|
30
|
+
parameter :count, 'how much padding to apply. defaults to configuration.padr_count', param_type: 'Int', default: 'nil'
|
31
|
+
parameter :char , 'character to pad with. defaults to configuration.padr_char', param_type: 'String', default: 'nil'
|
32
|
+
|
33
|
+
ruby <<-RUBY
|
34
|
+
value = '' if value.nil?
|
35
|
+
count = KConfig.configuration.cmdlet.padr_count if count.nil?
|
36
|
+
count = count.to_i if count.is_a?(String)
|
37
|
+
char = KConfig.configuration.cmdlet.padr_char if char.nil?
|
38
|
+
value.to_s.ljust(count, char)
|
24
39
|
RUBY
|
25
40
|
end
|
26
41
|
.generate
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [0.9.2](https://github.com/klueless-io/cmdlet/compare/v0.9.1...v0.9.2) (2022-08-24)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* add reset to cmdlet configuration ([72a14a8](https://github.com/klueless-io/cmdlet/commit/72a14a843e08015425c8f2fba44b4a8ccd175a85))
|
7
|
+
|
1
8
|
## [0.9.1](https://github.com/klueless-io/cmdlet/compare/v0.9.0...v0.9.1) (2022-08-24)
|
2
9
|
|
3
10
|
|
data/lib/cmdlet/_.rb
CHANGED
data/lib/cmdlet/str/padl.rb
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
module Cmdlet
|
4
4
|
# String manipulation
|
5
5
|
module Str
|
6
|
-
# Padl:
|
6
|
+
# Padl: take the value and give it padding on the left hand side
|
7
7
|
class Padl < Cmdlet::BaseCmdlet
|
8
8
|
#
|
9
9
|
# @param [String|Symbol|Int] value - value to apply padding to
|
10
10
|
# @param [Int] count - how much padding to apply. defaults to configuration.padl_count
|
11
11
|
# @param [String] char - character to pad with. defaults to configuration.padl_char
|
12
|
-
# @return [String] the value with
|
12
|
+
# @return [String] the value padded on LHS with [char (default ' ')] and [count (default 30)]
|
13
13
|
def call(value, count = nil, char = nil)
|
14
14
|
value = '' if value.nil?
|
15
15
|
count = KConfig.configuration.cmdlet.padl_count if count.nil?
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# String manipulation
|
5
|
+
module Str
|
6
|
+
# Padr: take the value and give it padding on the right hand side
|
7
|
+
class Padr < 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.padr_count
|
11
|
+
# @param [String] char - character to pad with. defaults to configuration.padr_char
|
12
|
+
# @return [String] the value padded on RHS with [char (default ' ')] and [count (default 30)]
|
13
|
+
def call(value, count = nil, char = nil)
|
14
|
+
value = '' if value.nil?
|
15
|
+
count = KConfig.configuration.cmdlet.padr_count if count.nil?
|
16
|
+
count = count.to_i if count.is_a?(String)
|
17
|
+
char = KConfig.configuration.cmdlet.padr_char if char.nil?
|
18
|
+
value.to_s.ljust(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.10.0",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "cmdlet",
|
9
|
-
"version": "0.
|
9
|
+
"version": "0.10.0",
|
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,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmdlet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- lib/cmdlet/inflection/singularize.rb
|
132
132
|
- lib/cmdlet/misc/safe.rb
|
133
133
|
- lib/cmdlet/str/padl.rb
|
134
|
+
- lib/cmdlet/str/padr.rb
|
134
135
|
- lib/cmdlet/string_tokenizer.rb
|
135
136
|
- lib/cmdlet/version.rb
|
136
137
|
- package-lock.json
|