# File lib/fastcst/command.rb, line 157 157: def run(args) 158: # find the command and change the program's name to reflect it 159: cmd_name = args.shift 160: $0 = "#{cmd_name}" 161: 162: # command exists, set it up and validate it 163: begin 164: command = Command.create(cmd_name, args) 165: rescue FactoryError 166: print_command_list 167: return 168: end 169: 170: # Normally the command is NOT valid right after being created 171: # but sometimes (like with -h or -v) there's no further processing 172: # needed so the command is already valid so we can skip it. 173: if not command.done_validating 174: if not command.validate 175: UI.failure :command, "#{cmd_name} reported an error.\n\n" 176: UI.event :help, command.help 177: return false 178: else 179: # and command checks out so run it 180: command.run 181: end 182: end 183: return true 184: end