Sha256: e4bcc8006552fc056eaca1350bf542df9babc3b8f726be00d31f1dd4aee00b23

Contents?: true

Size: 1.2 KB

Versions: 4

Compression:

Stored size: 1.2 KB

Contents

# Path to external node classifier, relative to the base directory of the checkout.
# @param parser [OptionParser object] The OptionParser argument
# @param options [Hash] Options hash being constructed; this is modified in this method.
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:enc) do
  has_weight 240

  def parse(parser, options)
    parser.on('--no-enc', 'Disable ENC') do
      options[:no_enc] = true
      options[:enc] = nil
      options[:from_enc] = nil
      options[:to_enc] = nil
    end

    parser.on('--enc PATH', 'Path to ENC script, relative to checkout directory or absolute') do |x|
      unless options[:no_enc]
        proposed_enc_path = x.start_with?('/') ? x : File.join(options[:basedir], x)
        raise Errno::ENOENT, "Provided ENC (#{proposed_enc_path}) does not exist" unless File.file?(proposed_enc_path)
        options[:enc] = proposed_enc_path
      end
    end

    parser.on('--from-enc PATH', 'Path to ENC script (for the from catalog only)') do |x|
      options[:from_enc] = x unless options[:no_enc]
    end

    parser.on('--to-enc PATH', 'Path to ENC script (for the to catalog only)') do |x|
      options[:to_enc] = x unless options[:no_enc]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
octocatalog-diff-0.5.6 lib/octocatalog-diff/catalog-diff/cli/options/enc.rb
octocatalog-diff-0.5.4 lib/octocatalog-diff/catalog-diff/cli/options/enc.rb
octocatalog-diff-0.5.3 lib/octocatalog-diff/catalog-diff/cli/options/enc.rb
octocatalog-diff-0.5.1 lib/octocatalog-diff/catalog-diff/cli/options/enc.rb