package com.uzen.slimapk;

import java.io.IOException;
import com.uzen.slimapk.struct.ApkOptions;
import com.uzen.slimapk.SlimApk;

class App {

    public static void main(String[] args) throws IOException {
        String[] path = new String[2];
        ApkOptions opt = parseArgs(args, path);
                			System.out.println(path[0]);
        if(opt != null && path[0] != null) 
        try (SlimApk apk = new SlimApk(path[0], path[1], opt)) {
        		System.out.println("#SlimApk\n" + apk.getConfig());
            apk.parseDirectories();
        }
    }
    
    private static ApkOptions parseArgs(final String[] args, String[] path) {
    	
        if (args.length < 1) {
        		System.out.println(getSupport());
        		return null;
        }

        String type = "arm", pattern = null;
        Boolean keepDir = false, cleanMode = false;
        
        for(int i=0; i < args.length; i++){
        		if(!args[i].startsWith("-")){
        			if(path[0] == null){
        				path[0] = args[i];
        			} else if(path[1] == null)
        				path[1] = args[i];
        			continue;
        		}
        		
        		if(args[i].startsWith("-p=")){
        			pattern = args[i].replaceFirst("-p=","");
        			continue;
        		}
        			 
         	switch (args[i]){
               case "-a32": case "--arm":
                   type = "arm";
                   break;
               case "-a64": case "--arm64":
                   type = "arm64";
                   break;
               case "-x86": case "--x86":
                   type = "x86";
                   break;
               case "-k": case "--keep-dir":
                   keepDir = true;
                   break;
               case "-h": case "--help":
                  System.out.println(getSupport());
                  return null;
               default:
               	System.out.println("Invalid argument: " +args[i]);
         	}   
        }
        
        //remove after:
        cleanMode = null;	//(new func.)cleaning whole apk of extra libraries
        /*------------*/
        
        return new ApkOptions(type, pattern, keepDir, cleanMode);
    }
    
    private static String getImplementation() {
        Package pkg = App.class.getPackage();
        return pkg.getImplementationVersion();
    }
    
    private static String getSupport() {
        return "\nUsage: slimapk [options...] <INPUT_FOLDER/FILE> <OUTPUT_FOLDER>\n\n" 
         + "options:\n" 
         + " -a32 (--arm) - ARM\n" 
         + " -a64 (--arm64) - ARM 64-bit\n" 
         + " -x86 (--x86) - X86\n" 
         + " -k (--keep-directory) keep the structure the f/s\n" 
         + " -p [-p=\"template for the file name\"]\n" 
         + " -h (--help) - help\n" 
         + "\nver. " + getImplementation() + "\n";
    }
}
@@ -311,37 +311,8 @@
   %09%09
-%09System.out.println(path%5B0%5D);
 %0A   
@@ -417,34 +417,36 @@
 opt)) %7B%0A        
-%09%09
+    
 System.out.print
@@ -661,18 +661,20 @@
         
-%09%09
+    
 System.o
@@ -707,18 +707,20 @@
         
-%09%09
+    
 return n
@@ -893,18 +893,22 @@
         
-%09%09
+      
 if(!args
@@ -938,18 +938,16 @@
        %09
-%09%09
 if(path%5B
@@ -964,27 +964,25 @@
 )%7B%0A        %09
-%09%09%09
+ 
 path%5B0%5D = ar
@@ -997,18 +997,16 @@
        %09
-%09%09
 %7D else i
@@ -1033,19 +1033,17 @@
        %09
-%09%09%09
+ 
 path%5B1%5D 
@@ -1054,34 +1054,32 @@
 gs%5Bi%5D;%0A        %09
-%09%09
 continue;%0A      
@@ -1072,34 +1072,38 @@
 ntinue;%0A        
+     
-%09%09
+ 
 %7D%0A        %09%09%0A   
@@ -1107,18 +1107,17 @@
         
-%09%09
+ 
 if(args%5B
@@ -1148,18 +1148,16 @@
        %09
-%09%09
 pattern 
@@ -1199,18 +1199,16 @@
        %09
-%09%09
 continue
@@ -1217,18 +1217,17 @@
         
-%09%09
+ 
 %7D%0A      
@@ -1242,17 +1242,17 @@
         
-%09
+ 
 switch (
@@ -1898,17 +1898,16 @@
         
-%09
 %7D   %0A   
@@ -2773,8 +2773,9 @@
 %0A    %7D%0A%7D
+%0A

Update App.java