@@ -0,0 +1,1652 @@
+package com.imasson.commandrouter.driver;%0A%0Aimport com.imasson.commandrouter.CommandRouter;%0A%0A/**%0A * The command driver that parse command from shell-style command line String.%0A *%0A * @author Masson%0A */%0Apublic class CommandLineDriver extends AbstractDriver %7B%0A%0A    @Override%0A    public CommandRouter.Op parseCommand(Object context, Object... rawArgs) %7B%0A        final Object rawArg = rawArgs%5B0%5D;%0A        if (!(rawArg instanceof String)) %7B%0A            throw new DriverException(%22RawArg of command must be String%22, rawArgs);%0A        %7D%0A%0A        String raw = (String) rawArg;%0A        String%5B%5D segments = raw.split(%22 --%22);%0A        if (segments.length == 0) %7B%0A            throw new DriverException(%22Error parsing command line: cannot find main segment%22, rawArgs);%0A        %7D%0A%0A        String mainSegment = segments%5B0%5D;%0A        String%5B%5D mainSpins = mainSegment.split(%22 %22);%0A        if (mainSpins.length %3C= 1) %7B%0A            throw new DriverException(%22Error parsing command line: cannot parse main segment%22, rawArgs);%0A        %7D%0A%0A        String handlerName = mainSpins%5B0%5D;%0A        String commandName = mainSpins%5B1%5D;%0A        CommandRouter.Op op = new CommandRouter.Op(context, handlerName, commandName);%0A%0A        for (int i = 1; i %3C segments.length; i++) %7B%0A            String segment = segments%5Bi%5D;%0A            String%5B%5D spins = segment.split(%22 %22);%0A            if (spins.length %3E 1) %7B%0A                String paramName = spins%5B0%5D;%0A                String paramValue = spins%5B1%5D;%0A                if (paramName != null && paramName.length() %3E 0) %7B%0A                    op.addArgument(paramName, paramValue);%0A                %7D%0A            %7D%0A        %7D%0A%0A        return op;%0A    %7D%0A%7D%0A

add command line format driver