def add_filter_options
@parser.separator ""
@parser.separator "Host Filters"
@parser.on('-W', '--with FILTER', 'Combined classes and facts filter') do |f|
f.split(" ").each do |filter|
begin
fact_parsed = parse_fact(filter)
@options[:filter]["fact"] << fact_parsed
rescue
@options[:filter]["cf_class"] << filter
end
end
end
@parser.on('-S', '--select FILTER', 'Compound filter combining facts and classes') do |f|
@options[:filter]["compound"] << Matcher.create_compound_callstack(f)
end
@parser.on('-F', '--wf', '--with-fact fact=val', 'Match hosts with a certain fact') do |f|
fact_parsed = parse_fact(f)
@options[:filter]["fact"] << fact_parsed if fact_parsed
end
@parser.on('-C', '--wc', '--with-class CLASS', 'Match hosts with a certain config management class') do |f|
@options[:filter]["cf_class"] << f
end
@parser.on('-A', '--wa', '--with-agent AGENT', 'Match hosts with a certain agent') do |a|
@options[:filter]["agent"] << a
end
@parser.on('-I', '--wi', '--with-identity IDENT', 'Match hosts with a certain configured identity') do |a|
@options[:filter]["identity"] << a
end
end