Sha256: 6f578076e98bb6497e7c233b0a869331324dcbaf0e5dd939fa32decc4c97d360

Contents?: true

Size: 644 Bytes

Versions: 10

Compression:

Stored size: 644 Bytes

Contents

# An abstract class shared by generators that filter by host
# Generators that loop over hosts and want to support this form of filtering might consider
# extending from this class and use this code in their host iterator
#   next if @options[:filter].kind_of?(String) && !host.name.match(@options[:filter])
class Slh::Cli::HostFilterableBase < Slh::Cli::CommandBase
  def default_options
   {:filter => :none}
  end
  def option_parser
    return OptionParser.new do |opts|
      opts.on('-f','--filter FILTER', "Output will be filtered by matching hosts if specified") do |value|
        @options[:filter] = value
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
shibboleths_lil_helper-1.0.9 lib/slh/cli/host_filterable_base.rb
shibboleths_lil_helper-1.0.8 lib/slh/cli/host_filterable_base.rb
shibboleths_lil_helper-1.0.7 lib/slh/cli/host_filterable_base.rb
shibboleths_lil_helper-1.0.6 lib/slh/cli/host_filterable_base.rb
shibboleths_lil_helper-1.0.5 lib/slh/cli/host_filterable_base.rb
shibboleths_lil_helper-1.0.4 lib/slh/cli/host_filterable_base.rb
shibboleths_lil_helper-1.0.3 lib/slh/cli/host_filterable_base.rb
shibboleths_lil_helper-1.0.2 lib/slh/cli/host_filterable_base.rb
shibboleths_lil_helper-1.0.1 lib/slh/cli/host_filterable_base.rb
shibboleths_lil_helper-1.0.0 lib/slh/cli/host_filterable_base.rb