wavefront-cli 4.1.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +7 -0
- data/lib/wavefront-cli/commands/base.rb +2 -1
- data/lib/wavefront-cli/output/base.rb +23 -1
- data/lib/wavefront-cli/output/json.rb +4 -0
- data/lib/wavefront-cli/output/ruby.rb +4 -0
- data/lib/wavefront-cli/output/yaml.rb +4 -0
- data/lib/wavefront-cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c4a1d42c967b17f864ba74a9f8581d04df349c014e27a2729c5d8e5587e436b
|
4
|
+
data.tar.gz: ca290107fdc4488e165ab07713692d446eb13ddd5e430f8ee63aaf33239bf430
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b28118415ce64ef71ddf2d04417b26079f796884f895a82510c3ccfcb9883c188972e6e07b0961896cbe8e90272198ace216957d035b2715892a1b9c260f2292
|
7
|
+
data.tar.gz: b8e523c837ae979c554476f6aaec258788374b1ade012669ead8c2f3a2b0ba9f88da88fa349761acdbd6f12beea1460bda6cd011fb5bf9b71fa7a0715feaf960
|
data/HISTORY.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 4.2.0 (01/07/2019)
|
4
|
+
* Add `-M` (`--items-only`) option to all commands. For
|
5
|
+
machine-parseable formats, this filters the API response, giving only
|
6
|
+
the `items` array, which should usually be suitable for batch
|
7
|
+
importing. This is a more sophisticated and flexible implementation of
|
8
|
+
4.1.0's `dump` subcommand.
|
9
|
+
|
3
10
|
## 4.1.0 (27/06/2019)
|
4
11
|
* Add `dump` subcommand for all importable object types. Produces
|
5
12
|
JSON or YAML output.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require_relative '../stdlib/string'
|
2
2
|
|
3
|
-
CMN = '[-
|
3
|
+
CMN = '[-DnVM] [-c file] [-P profile] [-E endpoint] [-t token] ' \
|
4
4
|
'[-f format]'.freeze
|
5
5
|
|
6
6
|
# A base class which all command classes extend.
|
@@ -20,6 +20,7 @@ class WavefrontCommandBase
|
|
20
20
|
'-n, --noop do not perform API calls',
|
21
21
|
'-V, --verbose be verbose',
|
22
22
|
'-f, --format=STRING output format',
|
23
|
+
'-M, --items-only only show items in machine-parseable formats',
|
23
24
|
'-h, --help show this message']
|
24
25
|
end
|
25
26
|
|
@@ -16,8 +16,8 @@ module WavefrontOutput
|
|
16
16
|
|
17
17
|
def initialize(resp = {}, options = {})
|
18
18
|
@cmd = options[:class]
|
19
|
-
@resp = resp
|
20
19
|
@options = options
|
20
|
+
@resp = filtered_response(resp)
|
21
21
|
end
|
22
22
|
|
23
23
|
# We used to call #run directly, but now we use this wrapper to
|
@@ -31,6 +31,24 @@ module WavefrontOutput
|
|
31
31
|
command_class.run
|
32
32
|
end
|
33
33
|
|
34
|
+
def filtered_response(resp)
|
35
|
+
return resp unless options[:itemsonly]
|
36
|
+
items_only(resp)
|
37
|
+
end
|
38
|
+
|
39
|
+
def items_only(resp)
|
40
|
+
if allow_items_only?
|
41
|
+
return resp[:items] if resp.key?(:items)
|
42
|
+
|
43
|
+
raise(WavefrontCli::Exception::UnsupportedOutput,
|
44
|
+
'API response does not contain items object.')
|
45
|
+
end
|
46
|
+
|
47
|
+
raise(WavefrontCli::Exception::UnsupportedOutput,
|
48
|
+
format("'%s' format does not support items-only output.",
|
49
|
+
my_format))
|
50
|
+
end
|
51
|
+
|
34
52
|
def my_format
|
35
53
|
self.class.name.split('::').last.downcase
|
36
54
|
end
|
@@ -47,5 +65,9 @@ module WavefrontOutput
|
|
47
65
|
require_relative command_file
|
48
66
|
Object.const_get(command_class_name).new(resp, options)
|
49
67
|
end
|
68
|
+
|
69
|
+
def allow_items_only?
|
70
|
+
false
|
71
|
+
end
|
50
72
|
end
|
51
73
|
end
|
@@ -1 +1 @@
|
|
1
|
-
WF_CLI_VERSION = '4.
|
1
|
+
WF_CLI_VERSION = '4.2.0'.freeze
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wavefront-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Fisher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|