From c87f9627efc8b612eb9b000acfcc6731cad15765 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Tue, 7 Oct 2025 09:12:22 +0200 Subject: Initial commit --- src/main.cc | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/main.cc (limited to 'src/main.cc') 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 + +#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 .\n"; + return 0; + } + return 0; +} -- cgit v1.2.3-70-g09d2