Class: AndParcel::CatalogCommand

Inherits:
Command
  • Object
show all
Defined in:
bin/parcel

Instance Method Summary collapse

Methods inherited from Command

inherited

Instance Method Details

#runObject



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'bin/parcel', line 114

def run
  if ARGV.size==0
    $stderr.puts "add/remove not provided"
    exit(-1)
  end
  
  op=ARGV.shift.downcase
  
  Trollop::die "invalid operation: #{op}" if !["add", "remove"].include?(op)
  Trollop::die "catalog nickname not provided" if ARGV.size==0
  
  nick=ARGV.shift

  if (op=='add')
    Trollop::die "catalog URL not provided" if ARGV.size==0
    
    AndParcel.catalogs.add(nick, ARGV.shift)
  else
    AndParcel.catalogs.remove(nick)
  end
end