mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-21 04:12:37 +09:00
Added != operator to filter. (#1930)
* Added != operator to filter.
* Update cli_helper.rb
(cherry picked from commit 5447d8a367)
This commit is contained in:
1 parent
d2c4443ee1
commit
48e8e10971
1 file changed
+4
-3
@@ -369,7 +369,7 @@ module CLIHelper
|
||||
def filter_data!(data, filter)
|
||||
# TBD: add more operators
|
||||
# operators=/(==|=|!=|<|<=|>|>=)/
|
||||
operators=/(=)/
|
||||
operators=/(=|!=)/
|
||||
|
||||
stems=filter.map do |s|
|
||||
m=s.match(/^(.*?)#{operators}(.*?)$/)
|
||||
@@ -394,11 +394,12 @@ module CLIHelper
|
||||
end
|
||||
end
|
||||
|
||||
data.reject! do |d|
|
||||
data.select! do |d|
|
||||
pass=true
|
||||
|
||||
stems.each do |s|
|
||||
if d[s[:index]]!=s[:right]
|
||||
|
||||
if d[s[:index]].public_send(s[:operator] == "=" ? "==" : s[:operator], s[:right])
|
||||
pass=false
|
||||
break
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user