package d3rty.AAA_app;


import java.util.logging.Level;
import java.util.logging.Logger;

import org.apache.commons.cli.BasicParser;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;

public class Cli {
    private static final Logger log = Logger.getLogger(Cli.class.getName());
    private String[] args = null;
    private Options options = new Options();

    public Cli(String[] args) {

        this.args = args;

        options.addOption("v", "var", true, "Here you can set parameter");
        options.addOption("l", "login", true, "your login");
        options.addOption("p", "password", true, "your password");
        options.addOption("res", "resource", true, "requested resource (e.g. 'AB.CD.E')");
        options.addOption("role", "role", true, "your role on this resource (READ/WRITE/EXECUTE)");
        options.addOption("ds", "datestart", true, "date of start using [YYYY-MM-DD]");
        options.addOption("de", "dateend", true, "date of end using [YYYY-MM-DD]");
        options.addOption("vol", "volume", true, "volume");
        options.addOption("h", "help", false, "show help");
    }

    public void parse() {
        CommandLineParser parser = new BasicParser();

        CommandLine cmd = null;
        try {
            cmd = parser.parse(options, args);

            if (cmd.hasOption("l")) {
                String[] arguments = cmd.getOptionValues("l");
                System.out.println("Login : " + arguments[0]);
            }

            if (cmd.hasOption("h"))
                help();

            if (cmd.hasOption("p")) {
                String[] arguments = cmd.getOptionValues("p");
                System.out.println("Password : " + arguments[0]);
            }

            if (cmd.hasOption("res")) {
                String[] arguments = cmd.getOptionValues("res");
                System.out.println("Resurse : " + arguments[0]);

            }

            if (cmd.hasOption("role")) {
                String[] arguments = cmd.getOptionValues("role");
                System.out.println("Role : " + arguments[0]);

            }

            if (cmd.hasOption("ds")) {
                String[] arguments = cmd.getOptionValues("ds");
                System.out.println("Date Start : " + arguments[0]);

            }

            if (cmd.hasOption("de")) {
                String[] arguments = cmd.getOptionValues("de");
                System.out.println("Date End : " + arguments[0]);

            }

            if (cmd.hasOption("val")) {
                String[] arguments = cmd.getOptionValues("val");
                System.out.println("Values : " + arguments[0]);

            }




        }
        catch (ParseException e) {
            log.log(Level.SEVERE, "Failed to parse comand line properties", e);
            help();
        }
    }

    private void help() {
        // This prints out some help
        HelpFormatter formater = new HelpFormatter();

        formater.printHelp("Main", options);
        System.exit(0);
    }
}
@@ -18,16 +18,50 @@
 _app;%0A%0A%0A
+import org.apache.commons.cli.*;%0A%0A
 import j
@@ -122,274 +122,8 @@
 r;%0A%0A
-import org.apache.commons.cli.BasicParser;%0Aimport org.apache.commons.cli.CommandLine;%0Aimport org.apache.commons.cli.CommandLineParser;%0Aimport org.apache.commons.cli.HelpFormatter;%0Aimport org.apache.commons.cli.Options;%0Aimport org.apache.commons.cli.ParseException;%0A%0A
 publ
@@ -1058,20 +1058,21 @@
  public 
-void
+Parse
  parse()
@@ -1117,13 +1117,13 @@
 new 
-Basic
+Posix
 Pars
@@ -1124,24 +1124,57 @@
 ixParser();%0A
+        Parse Data = new Parse();
 %0A        Com
@@ -1310,37 +1310,32 @@
         
-String%5B%5D arguments = 
+Data.setU_login(
 cmd.getO
@@ -1348,14 +1348,14 @@
 alue
-s
 (%22l%22)
+)
 ;%0A  
@@ -1404,77 +1404,28 @@
 %22 + 
-arguments%5B0%5D);%0A            %7D%0A%0A            if (cmd.hasOption(%22h%22))%0A   
+Data.getU_login());%0A
     
@@ -1432,24 +1432,18 @@
         
- help();
+%7D%0A
 %0A%0A      
@@ -1490,37 +1490,35 @@
         
-String%5B%5D arguments = 
+Data.setU_password(
 cmd.getO
@@ -1531,14 +1531,14 @@
 alue
-s
 (%22p%22)
+)
 ;%0A  
@@ -1586,28 +1586,36 @@
 d : %22 + 
-arguments%5B0%5D
+Data.getU_password()
 );%0A     
@@ -1680,37 +1680,34 @@
         
-String%5B%5D arguments = 
+Data.setU_resurse(
 cmd.getO
@@ -1720,16 +1720,16 @@
 alue
-s
 (%22res%22)
+)
 ;%0A  
@@ -1772,36 +1772,43 @@
 surse : %22 + 
-arguments%5B0%5D
+Data.getU_resurse()
 );%0A%0A        
@@ -1871,37 +1871,31 @@
         
-String%5B%5D arguments = 
+Data.setU_role(
 cmd.getO
@@ -1908,17 +1908,16 @@
 alue
-s
 (%22role%22)
 ;%0A  
@@ -1912,16 +1912,17 @@
 (%22role%22)
+)
 ;%0A      
@@ -1958,36 +1958,40 @@
 %22Role : %22 + 
-arguments%5B0%5D
+Data.getU_role()
 );%0A%0A        
@@ -2558,28 +2558,95 @@
  %7D%0A%0A
-%0A%0A%0A        %7D
+            if (cmd.hasOption(%22h%22) %7C%7C Data.isEmpty())%0A                help();%0A%0A
 %0A       
  cat
@@ -2641,16 +2641,18 @@
 %0A       
+ %7D
  catch (
@@ -2716,17 +2716,17 @@
 iled to 
-p
+P
 arse com
@@ -2781,16 +2781,37 @@
       %7D%0A
+        return Data;%0A
     %7D%0A%0A 
@@ -2839,44 +2839,8 @@
 ) %7B%0A
-        // This prints out some help
 %0A   

fix Cli