cmdlet 0.10.1 → 0.11.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: 339c0236ac01a729a36c0da60a0d65f4f708076ac9b2d25749efde8f0ccb152b
4
- data.tar.gz: 429869442ff36053c164977c42accad7cc8f20eabf0e80cb336e8dba327b6e7a
3
+ metadata.gz: 6659a6d4bf416f908c575410cde75b5f23c2513dacf6ff1d5f6ec05e12a3150a
4
+ data.tar.gz: 27aa63086e4b376e6e1fbc2b535f72d6bdfd938df1f4a5bf1547d1acec2cb66e
5
5
  SHA512:
6
- metadata.gz: 5c301e8f817c58f32b14f28fa0df8294318e55cdf5fbfc72bd430687793a729c5e916a70275065de08ec241a522c3a088f0d6802690aa5a682a8019ff35a2d46
7
- data.tar.gz: e3a46c2ca533382201158e246f57b99767079bcfb5967a5a16a9330ebd405751700cdc368b8a19e6d03a3ff1bbbd13cd97813e1278fa90fa814c35a1410b6f3f
6
+ metadata.gz: 9bb45535219a5928826cbe810b18797c2ed54cf310e9eb477c51fd4a272af236ac31899624649d2bd78e2772afb907ba8a01409225938a6a6a70ed6548617674
7
+ data.tar.gz: 395d9d3b29942a02d573b359a4a9fd731811947fc1f2a8c57fd66b3cfddab94e7be1ae3f040adb08c09b98e29bf3cf60bfec83f0f119181113f3896228d735a9
@@ -25,6 +25,31 @@
25
25
 
26
26
  ],
27
27
  "ruby": " value = '' if value.nil?\n value\n"
28
+ },
29
+ {
30
+ "name": "format_json",
31
+ "aliases": [
32
+
33
+ ],
34
+ "description": "FormatJson will take an object and write it out as pretty JSON",
35
+ "result": "value as pretty JSON string",
36
+ "category": "misc",
37
+ "category_description": "Miscellaneous cmdlets",
38
+ "base_class_require": null,
39
+ "base_class": null,
40
+ "parameters": [
41
+ {
42
+ "name": "value",
43
+ "description": "object to be converted to JSON string",
44
+ "splat": null,
45
+ "default": null,
46
+ "param_type": "Object"
47
+ }
48
+ ],
49
+ "examples": [
50
+
51
+ ],
52
+ "ruby": " return '{}' if value.nil?\n\n value = JSON.pretty_generate(value)\n\n value\n"
28
53
  }
29
54
  ]
30
55
  }
@@ -16,6 +16,21 @@ KManager.action :misc_commands do
16
16
  value
17
17
  RUBY
18
18
  end
19
+ .cmdlet do
20
+ name :format_json
21
+ description 'FormatJson will take an object and write it out as pretty JSON'
22
+ result 'value as pretty JSON string'
23
+
24
+ parameter :value, 'object to be converted to JSON string', param_type: 'Object'
25
+
26
+ ruby <<-RUBY
27
+ return '{}' if value.nil?
28
+
29
+ value = JSON.pretty_generate(value)
30
+
31
+ value
32
+ RUBY
33
+ end
19
34
  .generate
20
35
  # .debug
21
36
  end
data/.rubocop.yml CHANGED
@@ -41,7 +41,6 @@ Metrics/MethodLength:
41
41
  Style/ZeroLengthPredicate:
42
42
  Enabled: false
43
43
 
44
-
45
44
  Layout/LineLength:
46
45
  Max: 200
47
46
  # Ignores annotate output
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.10.1](https://github.com/klueless-io/cmdlet/compare/v0.10.0...v0.10.1) (2023-07-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update invalid spec ([c930cc2](https://github.com/klueless-io/cmdlet/commit/c930cc2549b7c355f6ca8e4007c955ea2126e023))
7
+
1
8
  # [0.10.0](https://github.com/klueless-io/cmdlet/compare/v0.9.2...v0.10.0) (2022-08-24)
2
9
 
3
10
 
data/lib/cmdlet/_.rb CHANGED
@@ -31,6 +31,7 @@ require_relative 'inflection/pluralize'
31
31
  require_relative 'inflection/pluralize_number'
32
32
  require_relative 'inflection/pluralize_number_word'
33
33
  require_relative 'inflection/singularize'
34
+ require_relative 'misc/format_json'
34
35
  require_relative 'misc/safe'
35
36
  require_relative 'str/padl'
36
37
  require_relative 'str/padr'
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cmdlet
4
+ # Miscellaneous cmdlets
5
+ module Misc
6
+ # FormatJson: FormatJson will take an object and write it out as pretty JSON
7
+ class FormatJson < Cmdlet::BaseCmdlet
8
+ #
9
+ # @param [Object] value - object to be converted to JSON string
10
+ # @return [String] value as pretty JSON string
11
+ def call(value)
12
+ return '{}' if value.nil?
13
+
14
+ JSON.pretty_generate(value)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cmdlet
4
- VERSION = '0.10.1'
4
+ VERSION = '0.11.0'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "cmdlet",
3
- "version": "0.10.1",
3
+ "version": "0.11.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "cmdlet",
9
- "version": "0.10.1",
9
+ "version": "0.11.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.10.1",
3
+ "version": "0.11.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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cmdlet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.11.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: 2023-07-05 00:00:00.000000000 Z
11
+ date: 2023-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -129,6 +129,7 @@ files:
129
129
  - lib/cmdlet/inflection/pluralize_number.rb
130
130
  - lib/cmdlet/inflection/pluralize_number_word.rb
131
131
  - lib/cmdlet/inflection/singularize.rb
132
+ - lib/cmdlet/misc/format_json.rb
132
133
  - lib/cmdlet/misc/safe.rb
133
134
  - lib/cmdlet/str/padl.rb
134
135
  - lib/cmdlet/str/padr.rb