Skip to content

Commit

Permalink
Make it possible to specify multiple "target" and "exclude" options
Browse files Browse the repository at this point in the history
  • Loading branch information
kamatama41 committed Dec 25, 2017
1 parent 6b38dd7 commit 0de1b38
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions bin/miam
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ ARGV.options do |opt|
opt.on('' , '--split-more') { split = :more }
opt.on('', '--format=FORMAT', [:ruby, :json]) {|v| format_passed = true; options[:format] = v }
opt.on('' , '--export-concurrency N', Integer) {|v| options[:export_concurrency] = v }
opt.on('' , '--target REGEXP') {|v| options[:target] = Regexp.new(v) }
opt.on('' , '--exclude REGEXP') {|v| options[:exclude] = Regexp.new(v) }
opt.on('' , '--target REGEXP') {|v| (options[:target] ||= []) << Regexp.new(v) }
opt.on('' , '--exclude REGEXP') {|v| (options[:exclude] ||= []) << Regexp.new(v) }
opt.on('' , '--ignore-login-profile') { options[:ignore_login_profile] = true }
opt.on('' , '--no-color') { options[:color] = false }
opt.on('' , '--no-progress') { options[:no_progress] = true }
Expand Down
4 changes: 2 additions & 2 deletions lib/miam/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -527,11 +527,11 @@ def target_matched?(name)
result = true

if @options[:exclude]
result &&= name !~ @options[:exclude]
result &&= @options[:exclude].all? {|r| name !~ r}
end

if @options[:target]
result &&= name =~ @options[:target]
result &&= @options[:target].any? {|r| name =~ r}
end

result
Expand Down
4 changes: 2 additions & 2 deletions lib/miam/dsl/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,11 @@ def target_matched?(name)
result = true

if @options[:exclude]
result &&= name !~ @options[:exclude]
result &&= @options[:exclude].all? {|r| name !~ r}
end

if @options[:target]
result &&= name =~ @options[:target]
result &&= @options[:target].any? {|r| name =~ r}
end

result
Expand Down

0 comments on commit 0de1b38

Please sign in to comment.