cmdlet 0.9.2 → 0.10.1

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: 339c0236ac01a729a36c0da60a0d65f4f708076ac9b2d25749efde8f0ccb152b
4
+ data.tar.gz: 429869442ff36053c164977c42accad7cc8f20eabf0e80cb336e8dba327b6e7a
5
5
  SHA512:
6
- metadata.gz: b2d034d9181ae8df4af4b20b945d34c37e8d18840468b60389138ffacf11207e14dc1e2515920f51ee603fbbeeff6e4bb5374b67bbe129f260fe05a7aef2a824
7
- data.tar.gz: 371df3b87ec636bfcc71056cfc0d35dc63346de016000c9cfe9c4c96c60ae817dd99c8334bc9bb8949a9e507daa5aad9b9583044b84c261f192dba240bcd2cbd
6
+ metadata.gz: 5c301e8f817c58f32b14f28fa0df8294318e55cdf5fbfc72bd430687793a729c5e916a70275065de08ec241a522c3a088f0d6802690aa5a682a8019ff35a2d46
7
+ data.tar.gz: e3a46c2ca533382201158e246f57b99767079bcfb5967a5a16a9330ebd405751700cdc368b8a19e6d03a3ff1bbbd13cd97813e1278fa90fa814c35a1410b6f3f
@@ -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/.rubocop.yml CHANGED
@@ -38,6 +38,10 @@ Metrics/BlockLength:
38
38
  Metrics/MethodLength:
39
39
  Max: 25
40
40
 
41
+ Style/ZeroLengthPredicate:
42
+ Enabled: false
43
+
44
+
41
45
  Layout/LineLength:
42
46
  Max: 200
43
47
  # Ignores annotate output
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [0.10.0](https://github.com/klueless-io/cmdlet/compare/v0.9.2...v0.10.0) (2022-08-24)
2
+
3
+
4
+ ### Features
5
+
6
+ * add str: :padl and str: padr ([8db11eb](https://github.com/klueless-io/cmdlet/commit/8db11eb2922b310bf945ff1e154f506489bba32a))
7
+
8
+ ## [0.9.2](https://github.com/klueless-io/cmdlet/compare/v0.9.1...v0.9.2) (2022-08-24)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * add reset to cmdlet configuration ([72a14a8](https://github.com/klueless-io/cmdlet/commit/72a14a843e08015425c8f2fba44b4a8ccd175a85))
14
+
1
15
  ## [0.9.1](https://github.com/klueless-io/cmdlet/compare/v0.9.0...v0.9.1) (2022-08-24)
2
16
 
3
17
 
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.1'
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.1",
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.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmdlet",
3
- "version": "0.9.2",
3
+ "version": "0.10.1",
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.9.2
4
+ version: 0.10.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-08-24 00:00:00.000000000 Z
11
+ date: 2023-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -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
@@ -159,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
160
  - !ruby/object:Gem::Version
160
161
  version: '0'
161
162
  requirements: []
162
- rubygems_version: 3.1.2
163
+ rubygems_version: 3.3.5
163
164
  signing_key:
164
165
  specification_version: 4
165
166
  summary: Cmdlet provides a set of functions (wrapped in the command pattern) that