diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 6b9d453..35f1753 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -9,13 +9,9 @@
-
-
-
+
-
-
@@ -95,7 +91,15 @@
1723512022104
-
+
+
+ 1723514215355
+
+
+
+ 1723514215355
+
+
@@ -103,6 +107,7 @@
-
+
+
\ No newline at end of file
diff --git a/net/screwgravity/vitality4j/standalone.java b/net/screwgravity/vitality4j/standalone.java
index 0f51fa6..e7ea901 100644
--- a/net/screwgravity/vitality4j/standalone.java
+++ b/net/screwgravity/vitality4j/standalone.java
@@ -2,7 +2,36 @@ package net.screwgravity.vitality4j;
public class standalone {
public static boolean fromTerminal = false;
- public static final int[] version = new int[]{0, 0, 0};
+ public static final int[] version = new int[]{0, 0, 1};
+ public static Verbosities verbosity = Verbosities.NORMAL;
+
+ // args parser
+ static boolean argIsTakingParam = false;
+ static String argWhichIsTakingParam = null;
+
+ // parsed instructions to be sent to Scotty
+ static String operation = "";
+ static String targetPath; // psarc file
+ static String sourcePath; // folder contents to import when using -c, list of files to export when using -x
+ static Scotty.CompressionFormats targetFormat = Scotty.CompressionFormats.ZLIB;
+ static byte targetStrength = 9;
+ static long targetBlockSize = 65536; // in bytes
+ static boolean makeAbsolute = false;
+ static boolean makeCaseInsensitive = false;
+
+ public enum Verbosities {
+ QUIET(0),
+ NORMAL(1),
+ VERBOSE(2);
+
+ private final int value;
+ Verbosities(final int value) {this.value = value;}
+
+ public int getValue() {
+ return value;
+ }
+ }
+
// This is used when Vitality4J is run from the terminal.
// Don't make calls to anything in the standalone class when using Vitality4j as a library.
//
@@ -11,16 +40,76 @@ public class standalone {
public static void main (String[] args) {
fromTerminal = true;
- boolean makeAbsolute = false;
- boolean makeCaseInsensitive = false;
-
if (args.length == 0) {
printHelpScreen();
} else if (args.length > 0) {
+ if (args[0].equals("-h")) {
+ printHelpScreen();
+ if (args.length > 1 && args[1].equals("-j")) {
+ printAboutScreen();
+ }
+ System.exit(0);
+ }
+ for (String s : args) {
+ if (!argIsTakingParam) {
+ switch (s) {
+ case "-j":
+ argIsTakingParam = false;
+ printAboutScreen();
+ break;
+ case "-h":
+ if (argWhichIsTakingParam == null) {
+ printHelpScreen();
+ } else {
+ System.out.println("WARNING: Argument \"-h\" provided but other commands were already given first, ignoring.");
+ }
+ break;
+ case "-q":
+ argIsTakingParam = false;
+ argWhichIsTakingParam = s;
+ verbosity = Verbosities.QUIET;
+ break;
+ case "-v":
+ argIsTakingParam = false;
+ argWhichIsTakingParam = s;
+ verbosity = Verbosities.VERBOSE;
+ break;
+ case "-i", "-t", "-e":
+ argIsTakingParam = false;
+ argWhichIsTakingParam = s;
+ setOperation(s);
+ break;
+ case "-I", "-c", "-E", "-x":
+ argIsTakingParam = true;
+ argWhichIsTakingParam = s;
+ setOperation(s);
+ break;
+ default:
+ System.out.println("invalid option: " + s);
+ break;
+ }
+ } else {
+ }
+ }
}
}
+ private static void setOperation(String str) {
+ if (!operation.isEmpty()) {System.out.println("WARNING: duplicate operation " + str + " replaces previous argument.");}
+ operation = str;
+ }
+
+ private static void printAboutScreen() {
+ System.out.println(
+ "Vitality4j " + version[0] + "." + version[1] + "." + version[2] + "\n" +
+ "Developed by bonkmaykr, Canithesis Interactive (screwgravity.net)\n" +
+ "\n" +
+ "Your copy of vita4j should have come with a license. If not, see:\n" +
+ "https://git.worlio.com/bonkmaykr/vitality4j/src/branch/master/LICENSE"
+ );
+ }
+
private static void printHelpScreen() {
System.out.println(
"usage: vita4j [options] \n" +
@@ -35,14 +124,14 @@ public class standalone {
" -x Extracts multiple files from a PSARC archive to the current working\n" +
" directory, from a TXT list of file paths. One file per line in the list.\n" +
" -y Overwrites conflicting files without asking.\n" +
- " -q Quiet, avoid printing to stdout.\n" +
+ " -q Quiet, avoid printing to stdout until an emergency.\n" +
" -v Verbose. Prints additional information to stdout.\n" +
" -h Prints this help screen that you're reading right now.\n" +
" -j Displays version and licensing information about Vitality4j.\n" +
"\n" +
"Creating a new PSARC:\n" +
" -b Sets the blocksize in bytes when creating a new archive. (default = 64 KB)\n" +
- " -g Sets the compression algorithm used\n" +
+ " -g Sets the compression algorithm used. (default = zlib)\n" +
" -u Makes the PSARC uncompressed. Shorthand for \"-a none\".\n" +
" -z Compresses the PSARC with zlib. Shorthand for \"-a zlib\".\n" +
" -l Compresses the PSARC with LZMA. Shorthand for \"-a lzma\".\n" +