Sha256: 2fb2fbdf5b04803d435515d93d608a4f49009bc6df5b17223dee7d968389ac15
Contents?: true
Size: 829 Bytes
Versions: 2
Compression:
Stored size: 829 Bytes
Contents
module Aid module GitConfig def git_config(key, value = nil) if value `git config --local --add #{key.inspect} #{value.inspect}` else git_value = `git config --get #{key.inspect}`.strip git_value.empty? ? nil : git_value end end def prompt_for_config!(key, prompt_msg, remedy) value = git_config(key) if value == "" || value.nil? puts <<~EOF Missing git config "#{key}": To find this value: #{remedy} EOF new_value = prompt(prompt_msg) if new_value.empty? abort "Empty value, aborting" else git_config(key, new_value) end end end def prompt(msg) print "#{msg} > " value = STDIN.gets.strip puts value end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
abtion-aid-0.3.2 | lib/aid/scripts/shared/git_config.rb |
abtion-aid-0.3.1 | lib/aid/scripts/shared/git_config.rb |