summaryrefslogtreecommitdiff
path: root/src/cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli.c')
-rw-r--r--src/cli.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/cli.c b/src/cli.c
index dbb2f4f..8df6539 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -17,6 +17,7 @@
You should have received a copy of the GNU General Public License
along with Nekopack. If not, see <http://www.gnu.org/licenses/>. */
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -25,6 +26,8 @@
#include "cli.h"
#include "crypto.h"
+#define NEKOPACK_VERSION "2.1.0b1"
+
/* Copies `optarg` into the out field of `p` and ensures that it ends in
a trailing path delimiter. */
@@ -64,6 +67,7 @@ struct params parse_args(int argc, char **argv) {
p.mode = USAGE;
return p;
}
+
p.mode = EXTRACT;
int cur = 0, opt_index = 0, count = 0;
@@ -86,25 +90,33 @@ struct params parse_args(int argc, char **argv) {
case 'h':
p.mode = HELP;
return p;
+
case 'V':
p.mode = VERSION;
return p;
+
case 'v':
p.verbose = true;
break;
+
case 'o':
count++;
parse_output_path(optarg, &p);
break;
+
case 'g':
count++;
parse_game_id(optarg, &p);
+ break;
+
case 'e':
p.mode = EXTRACT;
break;
+
case 'l':
p.mode = LIST;
break;
+
case 'c':
p.mode = CREATE;
}
@@ -124,3 +136,33 @@ struct params parse_args(int argc, char **argv) {
return p;
}
+
+
+void print_usage(char *progn) {
+ fprintf(stderr, "Usage: %s [OPTIONS] (ARCHIVES) [PATHS]\n", progn);
+}
+
+
+void print_version(void) {
+ printf("Nekopack version %s\nProgrammed by Jakob. "
+ "<http://jakob.space>\n", NEKOPACK_VERSION);
+}
+
+
+void print_help(void) {
+ printf("A tool for decompressing the XP3 archives used by Nekopara.\n\n"
+ " -h, --help\t\tDisplay this help page and exit.\n"
+ " -v, --version\tDisplay the currently installed version and "
+ "exit.\n\n"
+ " -e, --extract\tExtract the contents of the archive. This is "
+ "the default\n\t\t\taction if no mode argument is provided.\n"
+ " -l, --list\t\tList the contents of the archive.\n"
+ " -c, --create\t\tCreate a new XP3 archive.\n\n"
+ " -o, --output\t\tPath to extract files to.\n"
+ " -g, --game\t\tGame the archive is from. Required for file "
+ "decryption.\n"
+ " -q, --quiet\t\tDon't display information about extracted "
+ "files.\n\n"
+ "Supported games: nekopara_volume_0, nekopara_volume_0_steam,\n"
+ "nekopara_volume_1, nekopara_volume_1_steam\n");
+}