blob: 9756c87a201b8cc3f0007de346827f3120c46813 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#include "args.hh"
#include "config.h"
#include "image_processor.hh"
#include "spawner.hh"
#include <stdlib.h> // NOLINT(modernize-deprecated-headers)
#include <iostream>
#include <string_view>
#include <vector>
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<std::string_view> 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;
}
|