cmdlet 0.9.2 → 0.10.0

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: 416978ea2fed45c04256957b67bba7c405149ce5637daee003ebdacbbd38217c
4
- data.tar.gz: d105d0e3401c4a398ee44cdff000d4f1d204ecee6ee641a52398358575569a86
3
+ metadata.gz: 838f77f0abbcd638881e7172b1b51de493642ed08759d260bd19ec53f57cfa2c
4
+ data.tar.gz: 28b1aebad3a1ab88af71dd69c0bfbaf4925af1b5d3ed9ebebe853cc74612b518
5
5
  SHA512:
6
- metadata.gz: b2d034d9181ae8df4af4b20b945d34c37e8d18840468b60389138ffacf11207e14dc1e2515920f51ee603fbbeeff6e4bb5374b67bbe129f260fe05a7aef2a824
7
- data.tar.gz: 371df3b87ec636bfcc71056cfc0d35dc63346de016000c9cfe9c4c96c60ae817dd99c8334bc9bb8949a9e507daa5aad9b9583044b84c261f192dba240bcd2cbd
6
+ metadata.gz: ca04fe9945aef2e6a74074cf1667aa6bac38599323ec575e947a0fb04f917fe583a975912ad0fe7ae38577dde1cfcb8db4f876f2ecab5f0b9804b1beb3409677
7
+ data.tar.gz: 48158ed2c3f7d91764361ce27764809689049f3606a534e212cd360b7469eec939262c3221339e305a3a67870f8b38baa64c4a41423dec62217938eea6209a64
@@ -6,8 +6,8 @@
6
6
  "aliases": [
7
7
 
8
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",
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": null,
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": " 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"
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 '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'
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
- 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)
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
@@ -33,3 +33,4 @@ require_relative 'inflection/pluralize_number_word'
33
33
  require_relative 'inflection/singularize'
34
34
  require_relative 'misc/safe'
35
35
  require_relative 'str/padl'
36
+ require_relative 'str/padr'
@@ -3,13 +3,13 @@
3
3
  module Cmdlet
4
4
  # String manipulation
5
5
  module Str
6
- # Padl: pass through the value with &lt;&gt; and single and double quotes left as is
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 &lt;&gt; and single and double quotes left as is
12
+ # @return [String] the value padded on LHS with [char (default &#x27; &#x27;)] 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 &#x27; &#x27;)] 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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cmdlet
4
- VERSION = '0.9.2'
4
+ VERSION = '0.10.0'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "cmdlet",
3
- "version": "0.9.2",
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.2",
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmdlet",
3
- "version": "0.9.2",
3
+ "version": "0.10.0",
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cmdlet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
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