#include "args.hh" #include "config.h" #include "image_processor.hh" #include "spawner.hh" #include // NOLINT(modernize-deprecated-headers) #include #include #include 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"); std::vector arguments; if (!args->run(argc, argv, &arguments)) { args->print_error(std::cerr); std::cerr << "Try `sawmill --help` for usage.\n"; return EXIT_FAILURE; } if (opt_help->is_set()) { std::cout << "Usage: `sawmill [OPTION]...`\n" << "This is a window manager for Wayland.\n" << "\n"; args->print_help(std::cout); return EXIT_SUCCESS; } if (opt_version->is_set()) { std::cout << "sawmill " << VERSION << " written by Joel Klinghed.\n"; return EXIT_SUCCESS; } auto spawner = Spawner::create(); if (spawner.has_value()) { auto processor = spawner.value()->run(Spawner::Exec::kImageProcessor); if (processor.has_value()) { auto ret = image_processor::peek(**processor, "/home/the_jk/Downloads/image2vector.svg"); if (ret.has_value()) { std::cout << ret->width << "x" << ret->height << '\n'; } else { std::cerr << "Bad file\n"; } return EXIT_SUCCESS; } } std::cerr << "Unable to launch spawner.\n"; return EXIT_FAILURE; }