Sha256: 53876f5151af67c252ce2c857db8d2847c0a81528d10ed219a1746f8db248dfa

Contents?: true

Size: 737 Bytes

Versions: 3

Compression:

Stored size: 737 Bytes

Contents

module Git
  module Multi
    module_function

    def local_option(path, name, default = nil)
      value = `git -C #{path} config --local --get #{name}`.chomp.freeze
      value.empty? && default ? default : value
    end

    def global_options(name)
      list = `git config --global --get-all #{name}`
      list.split($RS).map(&:strip).map(&:freeze)
    end

    def global_option(name, default = nil)
      value = `git config --global --get #{name}`.chomp.freeze
      value.empty? && default ? default : value
    end

    def global_list(name, default = nil)
      global_option(name, default).split(',').map(&:strip).map(&:freeze)
    end

    def env_var(name, default = nil)
      ENV.fetch(name, default)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
git-multi-8.0.1 lib/git/multi/config.rb
git-multi-8.0.0 lib/git/multi/config.rb
git-multi-7.0.0 lib/git/multi/config.rb