# File lib/mongrel/command.rb, line 182
182:       def run(args)
183:         # find the command
184:         cmd_name = args.shift
185: 
186:         if !cmd_name or cmd_name == "?" or cmd_name == "help"
187:           print_command_list
188:           return true
189:         elsif cmd_name == "--version"
190:           STDERR.puts "Mongrel Web Server #{Mongrel::Const::MONGREL_VERSION}"
191:           return true
192:         end
193: 
194:         # command exists, set it up and validate it
195:         begin
196:           command = GemPlugin::Manager.instance.create("/commands/#{cmd_name}", :argv => args)
197:         rescue
198:           STDERR.puts "INVALID COMMAND: #$!"
199:           print_command_list
200:           return false
201:         end
202: 
203:         # Normally the command is NOT valid right after being created
204:         # but sometimes (like with -h or -v) there's no further processing
205:         # needed so the command is already valid so we can skip it.
206:         if not command.done_validating
207:           if not command.validate
208:             STDERR.puts "#{cmd_name} reported an error. Use mongrel_rails #{cmd_name} -h to get help."
209:             return false
210:           else
211:             command.run
212:           end
213:         end
214: 
215:         return true
216:       end