cmdlet 0.10.1 → 0.12.0
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/cmdlets/misc.json +51 -0
- data/.builders/generators/cmdlets/misc.rb +27 -0
- data/.rubocop.yml +0 -1
- data/CHANGELOG.md +14 -0
- data/lib/cmdlet/_.rb +2 -0
- data/lib/cmdlet/misc/format_json.rb +18 -0
- data/lib/cmdlet/misc/omit.rb +16 -0
- data/lib/cmdlet/version.rb +1 -1
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f91e448d01785272c8c2e8b0037fb14d9b63eb472998a06a765541a2c02427e7
|
4
|
+
data.tar.gz: 3059a55ef98d2b432b6edd38daef6a06bfaf174fdc1f0d4a7854f39be7bbf908
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c3971ab9b4262c11ba45a58f449b62bf82a994b660bf0c6f4806c8981aa384ff106f3d77d97d0be5d0a6f2371954758baa86cc14706d5ad3579a681c52603b6
|
7
|
+
data.tar.gz: 978c557923ae58e389c2bfe82a511d4e6dee22b82e91a3501b7e025c5175f54fce76b4b3e84591b372feb889ee5b8e37928ac8e56688a292020f3b49d619395d
|
@@ -25,6 +25,57 @@
|
|
25
25
|
|
26
26
|
],
|
27
27
|
"ruby": " value = '' if value.nil?\n value\n"
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"name": "omit",
|
31
|
+
"aliases": [
|
32
|
+
"ignore",
|
33
|
+
"comment_out"
|
34
|
+
],
|
35
|
+
"description": "this content will not get written out, useful for commenting out code",
|
36
|
+
"result": "empty stting",
|
37
|
+
"category": "misc",
|
38
|
+
"category_description": "Miscellaneous cmdlets",
|
39
|
+
"base_class_require": null,
|
40
|
+
"base_class": null,
|
41
|
+
"parameters": [
|
42
|
+
{
|
43
|
+
"name": "value",
|
44
|
+
"description": "value to omit",
|
45
|
+
"splat": null,
|
46
|
+
"default": null,
|
47
|
+
"param_type": "String|Int"
|
48
|
+
}
|
49
|
+
],
|
50
|
+
"examples": [
|
51
|
+
|
52
|
+
],
|
53
|
+
"ruby": " ''\n"
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"name": "format_json",
|
57
|
+
"aliases": [
|
58
|
+
|
59
|
+
],
|
60
|
+
"description": "FormatJson will take an object and write it out as pretty JSON",
|
61
|
+
"result": "value as pretty JSON string",
|
62
|
+
"category": "misc",
|
63
|
+
"category_description": "Miscellaneous cmdlets",
|
64
|
+
"base_class_require": null,
|
65
|
+
"base_class": null,
|
66
|
+
"parameters": [
|
67
|
+
{
|
68
|
+
"name": "value",
|
69
|
+
"description": "object to be converted to JSON string",
|
70
|
+
"splat": null,
|
71
|
+
"default": null,
|
72
|
+
"param_type": "Object"
|
73
|
+
}
|
74
|
+
],
|
75
|
+
"examples": [
|
76
|
+
|
77
|
+
],
|
78
|
+
"ruby": " return '{}' if value.nil?\n\n value = JSON.pretty_generate(value)\n\n value\n"
|
28
79
|
}
|
29
80
|
]
|
30
81
|
}
|
@@ -16,6 +16,33 @@ KManager.action :misc_commands do
|
|
16
16
|
value
|
17
17
|
RUBY
|
18
18
|
end
|
19
|
+
.cmdlet do
|
20
|
+
name :omit
|
21
|
+
aliases %i[ignore comment_out]
|
22
|
+
description 'this content will not get written out, useful for commenting out code'
|
23
|
+
result 'empty stting'
|
24
|
+
|
25
|
+
parameter :value, 'value to omit', param_type: 'String|Int'
|
26
|
+
|
27
|
+
ruby <<-RUBY
|
28
|
+
''
|
29
|
+
RUBY
|
30
|
+
end
|
31
|
+
.cmdlet do
|
32
|
+
name :format_json
|
33
|
+
description 'FormatJson will take an object and write it out as pretty JSON'
|
34
|
+
result 'value as pretty JSON string'
|
35
|
+
|
36
|
+
parameter :value, 'object to be converted to JSON string', param_type: 'Object'
|
37
|
+
|
38
|
+
ruby <<-RUBY
|
39
|
+
return '{}' if value.nil?
|
40
|
+
|
41
|
+
value = JSON.pretty_generate(value)
|
42
|
+
|
43
|
+
value
|
44
|
+
RUBY
|
45
|
+
end
|
19
46
|
.generate
|
20
47
|
# .debug
|
21
48
|
end
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
# [0.11.0](https://github.com/klueless-io/cmdlet/compare/v0.10.1...v0.11.0) (2023-07-16)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* add format_json ([f5f3dd5](https://github.com/klueless-io/cmdlet/commit/f5f3dd5512cdae79f42eb389f2f5a29f655ed9e6))
|
7
|
+
|
8
|
+
## [0.10.1](https://github.com/klueless-io/cmdlet/compare/v0.10.0...v0.10.1) (2023-07-05)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* update invalid spec ([c930cc2](https://github.com/klueless-io/cmdlet/commit/c930cc2549b7c355f6ca8e4007c955ea2126e023))
|
14
|
+
|
1
15
|
# [0.10.0](https://github.com/klueless-io/cmdlet/compare/v0.9.2...v0.10.0) (2022-08-24)
|
2
16
|
|
3
17
|
|
data/lib/cmdlet/_.rb
CHANGED
@@ -31,6 +31,8 @@ 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'
|
35
|
+
require_relative 'misc/omit'
|
34
36
|
require_relative 'misc/safe'
|
35
37
|
require_relative 'str/padl'
|
36
38
|
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
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Miscellaneous cmdlets
|
5
|
+
module Misc
|
6
|
+
# Omit: this content will not get written out, useful for commenting out code
|
7
|
+
class Omit < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [String|Int] value - value to omit
|
10
|
+
# @return [String] empty stting
|
11
|
+
def call(_value)
|
12
|
+
''
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
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.
|
3
|
+
"version": "0.12.0",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "cmdlet",
|
9
|
-
"version": "0.
|
9
|
+
"version": "0.12.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
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.
|
4
|
+
version: 0.12.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-
|
11
|
+
date: 2023-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -129,6 +129,8 @@ 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
|
133
|
+
- lib/cmdlet/misc/omit.rb
|
132
134
|
- lib/cmdlet/misc/safe.rb
|
133
135
|
- lib/cmdlet/str/padl.rb
|
134
136
|
- lib/cmdlet/str/padr.rb
|