Class: MGit::ConfigCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/mgit/commands/config.rb

Instance Method Summary collapse

Methods inherited from Command

#check_arity, execute, instance_each, list, load_commands, register_alias, register_command

Methods included from Output

#perror, #pinfo, #ptable, #pwarn

Instance Method Details

#arityObject



12
13
14
# File 'lib/mgit/commands/config.rb', line 12

def arity
  [2, 2]
end

#descriptionObject



20
21
22
# File 'lib/mgit/commands/config.rb', line 20

def description
  'configure MGit'
end

#execute(args) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/mgit/commands/config.rb', line 3

def execute(args)
  key = args[0]
  value = args[1]

  Configuration.set(key, value)
rescue ConfigurationError => e
  raise CommandUsageError.new(e.to_s, self)
end

#usageObject



16
17
18
# File 'lib/mgit/commands/config.rb', line 16

def usage
  'config <key> <value>'
end