Sha256: 649340a0dce6f6272fede554387296af0dd5577e5fc999bfcc7a30864a9933f0

Contents?: true

Size: 908 Bytes

Versions: 20

Compression:

Stored size: 908 Bytes

Contents

# frozen_string_literal: true

# Allow the bootstrap environment to be set up via the command line.
# @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(:bootstrap_environment) do
  has_weight 50

  def parse(parser, options)
    descriptive_text = 'Bootstrap script environment variables in key=value format'
    parser.on('--bootstrap-environment "key1=val1,key2=val2,..."', Array, descriptive_text) do |res|
      options[:bootstrap_environment] ||= {}
      res.each do |item|
        raise ArgumentError, "Bootstrap environment #{item} must be in key=value format!" unless item =~ /=/
        key, val = item.split(/=/, 2)
        options[:bootstrap_environment][key] = Regexp.last_match(1) if val.strip =~ /^['"]?(.+?)['"]?$/
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
octocatalog-diff-2.3.1 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-2.3.0 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-2.1.0 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-2.0.0 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-1.6.0 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-1.5.4 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-1.5.3 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-1.5.2 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-1.5.1 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-1.5.0 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-1.4.1 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-1.4.0 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-1.3.0 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-1.2.0 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-1.1.0 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-1.0.4 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-1.0.3 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-1.0.2 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-1.0.1 lib/octocatalog-diff/cli/options/bootstrap_environment.rb
octocatalog-diff-1.0.0 lib/octocatalog-diff/cli/options/bootstrap_environment.rb