@@ -0,0 +1,2643 @@
+import java.util.ArrayList;%0A%0A/**%0A *%0A * Command Line App%0A *%0A * How to Play with Argument in Java%0A *%0A * And How to Parse%0A *%0A *%0A * How this Works ??%0A *%0A * First of all We get argument from main method then we split it and get command%0A * what are doing using some other class we check is it available functions if available%0A * then we move to the work they want to do if not match then we print the usage%0A *%0A * Credits:%0A * Allah%0A *%0A * @author Sahid Almas%0A */%0A%0Apublic class ComApp %7B%0A%0A    private static final ArrayList%3CCommand%3E mCommands  = new ArrayList%3C%3E();%0A    private static String mArgsCommand = %22%22;%0A    private static String mStuffArgs = %22%22;%0A    private static String USAGE = %22  Command Line Demo %5Cn%22 +%0A            %22 Usage :%22 +%0A            %22 ComApp -p %5Btext%5D %5Cn%22 +%0A            %22 ComApp -about %5Cn%22;%0A%0A    public static void main(String%5B%5D args) %7B%0A%0A%0A%0A        if (args.length %3E 0) %7B%0A%0A            mArgsCommand = args%5B0%5D;%0A%0A        %7D%0A%0A        if (args.length %3E 1) %7B%0A            StringBuilder stringBuffer = new StringBuilder();%0A            for (int i = 1 ; i %3C args.length ; i++) %7B%0A%0A                if (i == 1 ) %7B%0A                    stringBuffer.append(args%5Bi%5D);%0A                %7Delse if (i %3E= 1 && i %3C=  args.length ) %7B%0A                    stringBuffer.append(%22 %22).append(args%5Bi%5D);%0A                %7D else if (i == args.length) %7B%0A                    stringBuffer.append(args%5Bi%5D);%0A                %7D%0A            %7D%0A            mStuffArgs = stringBuffer.toString();%0A        %7D%0A%0A%0A        mCommands.add(new Print(%22-p%22,mStuffArgs));%0A        mCommands.add(new About(%22-about%22,mStuffArgs));%0A        int CURSOR = 0;%0A        for (Command command : mCommands) %7B%0A%0A            if (command.getFunctionName().equals( mArgsCommand )) %7B%0A                command.function(mStuffArgs);%0A            %7D%0A            else %7B%0A                CURSOR++;%0A            %7D%0A%0A        %7D%0A        if (!mArgsCommand.equals(null)) %7B%0A            while (CURSOR == mCommands.size()) %7B%0A                System.out.println(USAGE);%0A                CURSOR--;%0A            %7D%0A        %7D%0A%0A%0A%0A%0A%0A    %7D%0A%0A    public static class Print extends Command %7B%0A%0A        protected Print(String func_name, String args) %7B%0A            super(func_name, args);%0A        %7D%0A%0A        @Override%0A        public void function(String argument) %7B%0A            System.out.println(argument);%0A        %7D%0A%0A    %7D%0A    %0A    public static class About extends Command %7B%0A%0A        protected About(String func_name, String args) %7B%0A%0A            super(func_name, args);%0A        %7D%0A%0A        @Override%0A        public void function(String argument) %7B%0A%0A            System.out.println(%22Command Line Demo By Sahid %3CAndroidFire%3E Almas%22);%0A        %7D%0A%0A    %7D%0A%0A%7D%0A

Create ComApp.java