class MGit::RemoveCommand

Public Instance Methods

arity() click to toggle source
# File lib/mgit/commands/remove.rb, line 16
def arity
  [1, 1]
end
description() click to toggle source
# File lib/mgit/commands/remove.rb, line 24
def description
  'remove a repository'
end
execute(args) click to toggle source
# File lib/mgit/commands/remove.rb, line 3
def execute(args)
  ptrn = args[0]

  repo = Registry.find do |r|
    r.name == ptrn || r.path == File.expand_path(ptrn)
  end

  fail CommandUsageError.new("Couldn't find repository matching '#{ptrn}'.", self) unless repo

  Registry.remove(repo.name)
  pinfo "Removed repository #{repo.name}."
end
usage() click to toggle source
# File lib/mgit/commands/remove.rb, line 20
def usage
  'remove <name/path>'
end