opennebula-cli 5.10.3 → 5.10.4
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/lib/cli_helper.rb +17 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad3060823e13f21b1ee8ae76cbb1f2165c8a0563
|
4
|
+
data.tar.gz: cb2f95a39909fcec43e11d16d9cec82e99c2d08c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c92ba1c685bbe0eb77c4a1c9080fb0ecb1001ddfac09c809bb25947aca34decb80d840924037a0e672905fd7ff1a408c50b7e4dd784e5e34f35898e0455dfe9b
|
7
|
+
data.tar.gz: f184df5c44b6fb8c6df50b1ba55411aa623f043e5ff478770cea72c3a4aab4be05b7599d27a328393a7a4c3149ab1f5ef1b8d4068d470a1c8e2ec9fe795f9360
|
data/lib/cli_helper.rb
CHANGED
@@ -19,6 +19,9 @@ require 'csv'
|
|
19
19
|
# CLI Helper
|
20
20
|
module CLIHelper
|
21
21
|
|
22
|
+
# Available operators for filtering operations
|
23
|
+
FILTER_OPS = %w[= != < <= > >= ~]
|
24
|
+
|
22
25
|
# CLI general options
|
23
26
|
LIST = {
|
24
27
|
:name => 'list',
|
@@ -55,7 +58,10 @@ module CLIHelper
|
|
55
58
|
:large => '--filter x,y,z',
|
56
59
|
:format => Array,
|
57
60
|
:description => "Filter data. An array is specified with\n" <<
|
58
|
-
' ' * 31 << 'column=value pairs.'
|
61
|
+
' ' * 31 << 'column=value pairs.' <<
|
62
|
+
' ' * 31 << "Valid operators #{FILTER_OPS.join(',')}" <<
|
63
|
+
' ' * 31 << 'e.g. NAME=test (match name with test)' <<
|
64
|
+
' ' * 31 << 'NAME~test (match test, te, tes..)'
|
59
65
|
}
|
60
66
|
|
61
67
|
OPERATOR = {
|
@@ -796,7 +802,7 @@ module CLIHelper
|
|
796
802
|
# @param data [Array] Array with data to filter
|
797
803
|
# @param options [Hash] Object with CLI user options
|
798
804
|
def filter_data!(data, options)
|
799
|
-
operators = /(
|
805
|
+
operators = /(#{FILTER_OPS.join('|')})/
|
800
806
|
filter = options[:filter]
|
801
807
|
|
802
808
|
if options.key?(:operator)
|
@@ -819,7 +825,7 @@ module CLIHelper
|
|
819
825
|
:index => index
|
820
826
|
}
|
821
827
|
else
|
822
|
-
CLIHelper.fail("Column '#{
|
828
|
+
CLIHelper.fail("Column '#{m[1]}' not found")
|
823
829
|
end
|
824
830
|
else
|
825
831
|
CLIHelper.fail("Expression '#{s}' incorrect")
|
@@ -830,7 +836,14 @@ module CLIHelper
|
|
830
836
|
pass = true
|
831
837
|
|
832
838
|
stems.each do |s|
|
833
|
-
|
839
|
+
case s[:operator]
|
840
|
+
when '='
|
841
|
+
op = '=='
|
842
|
+
when '~'
|
843
|
+
op = 'include?'
|
844
|
+
else
|
845
|
+
op = s[:operator]
|
846
|
+
end
|
834
847
|
|
835
848
|
if d[s[:index]].public_send(op, s[:right])
|
836
849
|
if log_operator == 'OR'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opennebula-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.10.
|
4
|
+
version: 5.10.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenNebula
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opennebula
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.10.
|
19
|
+
version: 5.10.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.10.
|
26
|
+
version: 5.10.4
|
27
27
|
description: Commands used to talk to OpenNebula
|
28
28
|
email: contact@opennebula.org
|
29
29
|
executables:
|