aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-10-22 19:41:58 +0100
committerGinger Bill <bill@gingerbill.org>2016-10-22 19:41:58 +0100
commitf60dc7b0a7f8bf8122df0fa3b4d12603a9775f87 (patch)
treeadd8d1125cf0bf5c40f0c6d39579705b2cb1bc98 /src/main.cpp
parenta675d3f94d2c10ce6e50b88c6c39b36c746a4d2a (diff)
Minor Style Fixes
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 661c4dcfe..8526234c1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,3 +1,5 @@
+#define VERSION_STRING "v0.0.3"
+
#include "common.cpp"
#include "profiler.cpp"
#include "unicode.cpp"
@@ -88,9 +90,20 @@ ArchData make_arch_data(ArchKind kind) {
return data;
}
+void usage(char *argv0) {
+ gb_printf_err("%s is a tool for managing Odin source code\n", argv0);
+ gb_printf_err("Usage:");
+ gb_printf_err("\n\t%s command [arguments]\n", argv0);
+ gb_printf_err("Commands:");
+ gb_printf_err("\n\tbuild compile .odin file");
+ gb_printf_err("\n\trun compile and run .odin file");
+ gb_printf_err("\n\tversion print Odin version");
+ gb_printf_err("\n\n");
+}
+
int main(int argc, char **argv) {
if (argc < 2) {
- gb_printf_err("using: %s [run] <filename> \n", argv[0]);
+ usage(argv[0]);
return 1;
}
prof_init();
@@ -104,11 +117,20 @@ int main(int argc, char **argv) {
init_universal_scope();
- char *init_filename = argv[1];
+ char *init_filename = NULL;
b32 run_output = false;
- if (gb_strncmp(argv[1], "run", 3) == 0) {
+ String arg1 = make_string(argv[1]);
+ if (arg1 == "run") {
run_output = true;
init_filename = argv[2];
+ } else if (arg1 == "build") {
+ init_filename = argv[2];
+ } else if (arg1 == "version") {
+ gb_printf("%s version %s", argv[0], VERSION_STRING);
+ return 0;
+ } else {
+ usage(argv[0]);
+ return 1;
}
Parser parser = {0};