cmdlet 0.9.0 → 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/categories.json +4 -0
- data/.builders/data/cmdlets/str.json +83 -0
- data/.builders/generators/20-categories.rb +1 -0
- data/.builders/generators/cmdlets/str.rb +44 -0
- data/CHANGELOG.md +21 -0
- data/lib/cmdlet/_.rb +2 -0
- data/lib/cmdlet/configuration.rb +5 -0
- data/lib/cmdlet/str/padl.rb +22 -0
- 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 +6 -2
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
|
@@ -0,0 +1,83 @@
|
|
1
|
+
{
|
2
|
+
"category_key": "str",
|
3
|
+
"cmdlets": [
|
4
|
+
{
|
5
|
+
"name": "padl",
|
6
|
+
"aliases": [
|
7
|
+
|
8
|
+
],
|
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
|
+
"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": "nil",
|
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": "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,
|
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",
|
74
|
+
"param_type": "String"
|
75
|
+
}
|
76
|
+
],
|
77
|
+
"examples": [
|
78
|
+
|
79
|
+
],
|
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"
|
81
|
+
}
|
82
|
+
]
|
83
|
+
}
|
@@ -9,6 +9,7 @@ KManager.action :categories do
|
|
9
9
|
.category(:comparison , 'Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.')
|
10
10
|
.category(:inflection , 'Inflection handling routines, eg. pluralize, singular, ordinalize')
|
11
11
|
.category(:misc , 'Miscellaneous cmdlets')
|
12
|
+
.category(:str , 'String manipulation')
|
12
13
|
.save_categories
|
13
14
|
.generate
|
14
15
|
end
|
@@ -0,0 +1,44 @@
|
|
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 '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
|
+
|
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', default: 'nil'
|
14
|
+
parameter :char , 'character to pad with. defaults to configuration.padl_char', param_type: 'String', default: 'nil'
|
15
|
+
|
16
|
+
ruby <<-RUBY
|
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)
|
39
|
+
RUBY
|
40
|
+
end
|
41
|
+
.generate
|
42
|
+
# .debug
|
43
|
+
end
|
44
|
+
end
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
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
|
+
|
8
|
+
## [0.9.1](https://github.com/klueless-io/cmdlet/compare/v0.9.0...v0.9.1) (2022-08-24)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* add string category (str) and padl ([36e3487](https://github.com/klueless-io/cmdlet/commit/36e348715812792dc1d139f56027f82e0ec67f82))
|
14
|
+
|
15
|
+
# [0.9.0](https://github.com/klueless-io/cmdlet/compare/v0.8.0...v0.9.0) (2022-07-16)
|
16
|
+
|
17
|
+
|
18
|
+
### Features
|
19
|
+
|
20
|
+
* add safe support ([df784a2](https://github.com/klueless-io/cmdlet/commit/df784a2ce0b95fd46b6a2d10f55d858afa377fe3))
|
21
|
+
|
1
22
|
# [0.8.0](https://github.com/klueless-io/cmdlet/compare/v0.7.1...v0.8.0) (2022-07-15)
|
2
23
|
|
3
24
|
|
data/lib/cmdlet/_.rb
CHANGED
data/lib/cmdlet/configuration.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# String manipulation
|
5
|
+
module Str
|
6
|
+
# Padl: take the value and give it padding on the left hand side
|
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 padded on LHS 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.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
|
@@ -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,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.10.0
|
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
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- ".builders/data/cmdlets/comparison.json"
|
63
63
|
- ".builders/data/cmdlets/inflection.json"
|
64
64
|
- ".builders/data/cmdlets/misc.json"
|
65
|
+
- ".builders/data/cmdlets/str.json"
|
65
66
|
- ".builders/director/category_builder.rb"
|
66
67
|
- ".builders/director/category_dao.rb"
|
67
68
|
- ".builders/director/category_director.rb"
|
@@ -79,6 +80,7 @@ files:
|
|
79
80
|
- ".builders/generators/cmdlets/comparison.rb"
|
80
81
|
- ".builders/generators/cmdlets/inflection.rb"
|
81
82
|
- ".builders/generators/cmdlets/misc.rb"
|
83
|
+
- ".builders/generators/cmdlets/str.rb"
|
82
84
|
- ".releaserc.json"
|
83
85
|
- ".rspec"
|
84
86
|
- ".rubocop.yml"
|
@@ -128,6 +130,8 @@ files:
|
|
128
130
|
- lib/cmdlet/inflection/pluralize_number_word.rb
|
129
131
|
- lib/cmdlet/inflection/singularize.rb
|
130
132
|
- lib/cmdlet/misc/safe.rb
|
133
|
+
- lib/cmdlet/str/padl.rb
|
134
|
+
- lib/cmdlet/str/padr.rb
|
131
135
|
- lib/cmdlet/string_tokenizer.rb
|
132
136
|
- lib/cmdlet/version.rb
|
133
137
|
- package-lock.json
|