Sha256: ef3de987eefa300b168b0de1e4f370ef13ff5fab7e6eb464d684c4a7302a1743

Contents?: true

Size: 936 Bytes

Versions: 6

Compression:

Stored size: 936 Bytes

Contents

# frozen_string_literal: true

# Set hostname, which is used to look up facts in PuppetDB, and in the header of diff display.
# This option can recieve a single hostname, or a comma separated list of
# multiple hostnames, which are split into an Array. Multiple hostnames do not
# work with the `catalog-only` or `bootstrap-then-exit` options.
# @param parser [OptionParser object] The OptionParser argument
# @param options [Hash] Options hash being constructed; this is modified in this method.

OctocatalogDiff::Cli::Options::Option.newoption(:hostname) do
  has_weight 1

  def parse(parser, options)
    parser.on(
      '--hostname HOSTNAME1[,HOSTNAME2[,...]]',
      '-n',
      'Use PuppetDB facts from last run of a hostname or a comma separated list of multiple hostnames'
    ) do |hostname|
      options[:node] = if hostname.include?(',')
        hostname.split(',')
      else
        hostname
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
octocatalog-diff-2.3.1 lib/octocatalog-diff/cli/options/hostname.rb
octocatalog-diff-2.3.0 lib/octocatalog-diff/cli/options/hostname.rb
octocatalog-diff-2.1.0 lib/octocatalog-diff/cli/options/hostname.rb
octocatalog-diff-2.0.0 lib/octocatalog-diff/cli/options/hostname.rb
octocatalog-diff-1.6.0 lib/octocatalog-diff/cli/options/hostname.rb
octocatalog-diff-1.5.4 lib/octocatalog-diff/cli/options/hostname.rb