summaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2025-10-07 09:12:22 +0200
committerJoel Klinghed <the_jk@spawned.biz>2025-10-07 09:13:15 +0200
commitc87f9627efc8b612eb9b000acfcc6731cad15765 (patch)
tree34eb4b9e70a51c2f3db3a97c2aef31ba0b139ec9 /src/main.cc
Initial commit
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main.cc b/src/main.cc
new file mode 100644
index 0000000..e66f95a
--- /dev/null
+++ b/src/main.cc
@@ -0,0 +1,31 @@
+#include "args.hh"
+#include "config.h"
+
+#include <iostream>
+
+#ifndef VERSION
+# define VERSION "unknown"
+#endif
+
+int main(int argc, char** argv) {
+ auto args = Args::create();
+ auto opt_help = args->option('h', "help", "display this text and exit.");
+ auto opt_version = args->option('V', "version", "display version and exit.");
+ if (!args->run(argc, argv)) {
+ args->print_error(std::cerr);
+ std::cerr << "Try 'bluetooth-jukebox --help' for more information.\n";
+ return 1;
+ }
+ if (opt_help->is_set()) {
+ std::cout << "Usage: bluetooth-jukebox [OPTION...]\n"
+ << "\n";
+ args->print_help(std::cout);
+ return 0;
+ }
+ if (opt_version->is_set()) {
+ std::cout << "bluetooth-jukebox " << VERSION
+ << " written by Joel Klinghed <the_jk@spawned.biz>.\n";
+ return 0;
+ }
+ return 0;
+}