-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.cpp
36 lines (24 loc) · 804 Bytes
/
Main.cpp
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
#include <string>
#include "HexViewer.h"
#include "CLI11.hpp"
int main(int argc, char** argv)
{
CLI::App app("HexViewer");
std::string fileName;
app.add_option("filename", fileName, "Filename")->required();
std::string theme = "hexyl";
app.add_option("-t,--theme", theme, "Theme");
int offset = 0;
app.add_option("-s,--offset", offset, "Offset");
size_t length = 0;
app.add_option("-l,--length", length, "Length");
bool noColor = false;
app.add_flag("-n,--no-colors", noColor, "No colors");
CLI11_PARSE(app, argc, argv);
HexViewer hexViewer;
hexViewer.setStyle(theme, !noColor);
hexViewer.setPrinter("default");
hexViewer.setFile(fileName);
hexViewer.print(offset, length);
return 0;
}