cmdlet 0.9.0 → 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 +4 -0
- data/.builders/data/cmdlets/str.json +44 -0
- data/.builders/generators/20-categories.rb +1 -0
- data/.builders/generators/cmdlets/str.rb +29 -0
- data/CHANGELOG.md +7 -0
- data/lib/cmdlet/_.rb +1 -0
- data/lib/cmdlet/configuration.rb +5 -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 +5 -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
|
@@ -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
|
+
}
|
@@ -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,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,10 @@
|
|
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
|
+
|
1
8
|
# [0.8.0](https://github.com/klueless-io/cmdlet/compare/v0.7.1...v0.8.0) (2022-07-15)
|
2
9
|
|
3
10
|
|
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: 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.9.
|
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.
|
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.9.
|
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
|
@@ -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,7 @@ 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
|
131
134
|
- lib/cmdlet/string_tokenizer.rb
|
132
135
|
- lib/cmdlet/version.rb
|
133
136
|
- package-lock.json
|