Open BioBoost opened 1 year ago
Alternative is basic getopt
which is less powerful:
#include <getopt.h>
#include <iostream>
int main(int argc, char* argv[]) {
option longopts[] = {
{"prefix", optional_argument, nullptr, 'p'},
{"binary", optional_argument, nullptr, 'b'},
{"hex", optional_argument, nullptr, 'h'}, {0}
};
while (1) {
const int opt = getopt_long(argc, argv, "pbh::", longopts, 0);
if (opt == -1) {
break;
}
switch (opt) {
case 'p':
// ...
std::cout << "Remove prefix" << std::endl;
break;
case 'b':
std::cout << "Binary" << std::endl;
// ...
break;
case 'h':
std::cout << "Hex" << std::endl;
// ...
break;
}
}
//...
}
https://github.com/jarro2783/cxxopts