opennebula-cli 5.10.3 → 5.10.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cli_helper.rb +17 -4
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db84680874bbde511e8ffc04129cf914bf23e04b
4
- data.tar.gz: ba353a408b6ac968cf13fe5e3cd062d08bb5ed91
3
+ metadata.gz: ad3060823e13f21b1ee8ae76cbb1f2165c8a0563
4
+ data.tar.gz: cb2f95a39909fcec43e11d16d9cec82e99c2d08c
5
5
  SHA512:
6
- metadata.gz: 1709c9dbc7100d21beb1c0ca96f1c8281bdda6758a727f30cbe98b49ffbdafd7ccc659d3bf8db2e46abb70ec9007225478170c7d94c07c454a2e061cfec42975
7
- data.tar.gz: 0a1bf968f039c46a6a6b032ef9888caf86c88946361650e2c109bc9ed8006cb62f3056556e10b4fedb9f6d4cd1c3c53b98c74e3b4cf4666e09d254766f69ef71
6
+ metadata.gz: c92ba1c685bbe0eb77c4a1c9080fb0ecb1001ddfac09c809bb25947aca34decb80d840924037a0e672905fd7ff1a408c50b7e4dd784e5e34f35898e0455dfe9b
7
+ data.tar.gz: f184df5c44b6fb8c6df50b1ba55411aa623f043e5ff478770cea72c3a4aab4be05b7599d27a328393a7a4c3149ab1f5ef1b8d4068d470a1c8e2ec9fe795f9360
@@ -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 '#{left}' not found")
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
- s[:operator] == '=' ? op = '==' : op = s[:operator]
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.3
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-03-08 00:00:00.000000000 Z
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.3
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.3
26
+ version: 5.10.4
27
27
  description: Commands used to talk to OpenNebula
28
28
  email: contact@opennebula.org
29
29
  executables: