class MGit::ConfigCommand
Public Instance Methods
arity()
click to toggle source
# File lib/mgit/commands/config.rb, line 26 def arity [0, 2] end
description()
click to toggle source
# File lib/mgit/commands/config.rb, line 34 def description 'configure MGit' end
execute(args)
click to toggle source
# File lib/mgit/commands/config.rb, line 3 def execute(args) if args.size == 0 t = [] Configuration.each { |k, v| t << [k.to_s, v] } ptable t else key = args[0] if args.size == 1 psystem Configuration.send(key.to_sym).to_s else key = args[0] value = args[1] begin Configuration.set(key, value) rescue ConfigurationError => e raise CommandUsageError.new(e.to_s, self) end end end end
usage()
click to toggle source
# File lib/mgit/commands/config.rb, line 30 def usage 'config <key> <value>' end