cmdlet 0.8.0 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27e7a1e05d48209204f34c1e04f991ed01d3d3eca2ecbe9f841826cadc177df7
4
- data.tar.gz: 847c0632e9e33f52b014eb04bd27fcda83dea0e1837d9dcc9d7d515cc2aeb02b
3
+ metadata.gz: 416978ea2fed45c04256957b67bba7c405149ce5637daee003ebdacbbd38217c
4
+ data.tar.gz: d105d0e3401c4a398ee44cdff000d4f1d204ecee6ee641a52398358575569a86
5
5
  SHA512:
6
- metadata.gz: b4501a96777d21750f4c1ea03e47305b297605e96cd6f076bfdd8af2953fa47f465ddf0a9847fb5fa87dceecd5c33cb8eee2d421a65d4b08d9047c5e07482f02
7
- data.tar.gz: 0dfb170d52bfdbca451e2888be1e2b501a448cd0392ed0931404ce7c166c53f30f860b8fac46e57c8180c8f02958a578d86c322b1f1b2bfe160645ce8daa831b
6
+ metadata.gz: b2d034d9181ae8df4af4b20b945d34c37e8d18840468b60389138ffacf11207e14dc1e2515920f51ee603fbbeeff6e4bb5374b67bbe129f260fe05a7aef2a824
7
+ data.tar.gz: 371df3b87ec636bfcc71056cfc0d35dc63346de016000c9cfe9c4c96c60ae817dd99c8334bc9bb8949a9e507daa5aad9b9583044b84c261f192dba240bcd2cbd
@@ -19,6 +19,10 @@
19
19
  {
20
20
  "name": "misc",
21
21
  "description": "Miscellaneous cmdlets"
22
+ },
23
+ {
24
+ "name": "str",
25
+ "description": "String manipulation"
22
26
  }
23
27
  ]
24
28
  }
@@ -14,8 +14,8 @@
14
14
  "base_class": null,
15
15
  "parameters": [
16
16
  {
17
- "name": "values",
18
- "description": "valure to pass throught",
17
+ "name": "value",
18
+ "description": "value to pass through",
19
19
  "splat": null,
20
20
  "default": null,
21
21
  "param_type": "String|Int"
@@ -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
@@ -9,7 +9,7 @@ KManager.action :misc_commands do
9
9
  description 'pass through the value with <> and single and double quotes left as is'
10
10
  result 'the value with <> and single and double quotes left as is'
11
11
 
12
- parameter :values, 'valure to pass throught', param_type: 'String|Int'
12
+ parameter :value, 'value to pass through', param_type: 'String|Int'
13
13
 
14
14
  ruby <<-RUBY
15
15
  value = '' if value.nil?
@@ -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.1](https://github.com/klueless-io/cmdlet/compare/v0.9.0...v0.9.1) (2022-08-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add string category (str) and padl ([36e3487](https://github.com/klueless-io/cmdlet/commit/36e348715812792dc1d139f56027f82e0ec67f82))
7
+
8
+ # [0.9.0](https://github.com/klueless-io/cmdlet/compare/v0.8.0...v0.9.0) (2022-07-16)
9
+
10
+
11
+ ### Features
12
+
13
+ * add safe support ([df784a2](https://github.com/klueless-io/cmdlet/commit/df784a2ce0b95fd46b6a2d10f55d858afa377fe3))
14
+
15
+ # [0.8.0](https://github.com/klueless-io/cmdlet/compare/v0.7.1...v0.8.0) (2022-07-15)
16
+
17
+
18
+ ### Features
19
+
20
+ * add misc: :safe ([3a24c37](https://github.com/klueless-io/cmdlet/commit/3a24c3796b478164a4e36486d4619396a84880b9))
21
+
1
22
  ## [0.7.1](https://github.com/klueless-io/cmdlet/compare/v0.7.0...v0.7.1) (2022-07-15)
2
23
 
3
24
 
data/lib/cmdlet/_.rb CHANGED
@@ -32,3 +32,4 @@ require_relative 'inflection/pluralize_number'
32
32
  require_relative 'inflection/pluralize_number_word'
33
33
  require_relative 'inflection/singularize'
34
34
  require_relative 'misc/safe'
35
+ require_relative 'str/padl'
@@ -22,6 +22,11 @@ module Cmdlet
22
22
 
23
23
  def initialize
24
24
  @tokenizer = Cmdlet::StringTokenizer.new
25
+
26
+ reset
27
+ end
28
+
29
+ def reset
25
30
  @padr_count = 30
26
31
  @padr_char = ' '
27
32
  @padl_count = 30
@@ -6,9 +6,9 @@ module Cmdlet
6
6
  # Safe: pass through the value with &lt;&gt; and single and double quotes left as is
7
7
  class Safe < Cmdlet::BaseCmdlet
8
8
  #
9
- # @param [String|Int] values - valure to pass throught
9
+ # @param [String|Int] value - value to pass through
10
10
  # @return [String] the value with &lt;&gt; and single and double quotes left as is
11
- def call(_values)
11
+ def call(value)
12
12
  value = '' if value.nil?
13
13
  value
14
14
  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 &lt;&gt; 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 &lt;&gt; 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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cmdlet
4
- VERSION = '0.8.0'
4
+ VERSION = '0.9.2'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "cmdlet",
3
- "version": "0.8.0",
3
+ "version": "0.9.2",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "cmdlet",
9
- "version": "0.8.0",
9
+ "version": "0.9.2",
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmdlet",
3
- "version": "0.8.0",
3
+ "version": "0.9.2",
4
4
  "description": "Cmdlet provides a set of functions (wrapped in the command pattern) that perform simple actions",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
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.8.0
4
+ version: 0.9.2
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-07-15 00:00:00.000000000 Z
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