This commit is contained in:
parent
1b61b87cc7
commit
f307ed3448
28
src/main.cpp
28
src/main.cpp
@ -1,8 +1,8 @@
|
|||||||
#include "color.h"
|
#include <unistd.h>
|
||||||
#include "const.h"
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <unistd.h>
|
#include "color.h"
|
||||||
|
#include "const.h"
|
||||||
|
|
||||||
void PrintHelp() {
|
void PrintHelp() {
|
||||||
std::cout << RED R"( ____ ____
|
std::cout << RED R"( ____ ____
|
||||||
@ -24,21 +24,21 @@ void PrintVersion() {
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
int opt;
|
int opt;
|
||||||
while ((opt = getopt(argc, argv, "hV")) != -1) {
|
while ((opt = getopt(argc, argv, "hV")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'h':
|
case 'h':
|
||||||
PrintHelp();
|
PrintHelp();
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
PrintVersion();
|
PrintVersion();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
std::cerr << RED "[ERROR]" << RESET " invalid option: " << (char)optopt
|
std::cerr << RED "[ERROR]" << RESET " invalid option: " << (char)optopt
|
||||||
<< "\ntry: -h\n";
|
<< "\ntry: -h\n";
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user