the rest is just mere programming...master
parent
a44ac62617
commit
5c5e49c03e
@ -1,17 +1,48 @@
|
||||
/*
|
||||
Copyright 2018 Denes Matetelki <denes@matetelki.com>
|
||||
|
||||
This file is part of webfish.
|
||||
|
||||
webfish is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License v3 as published by the Free
|
||||
Software Foundation.
|
||||
|
||||
webfish is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License v3 for
|
||||
more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License v3 along
|
||||
with webfish. If not, see
|
||||
https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <cpp_utils/ArgParse.hpp>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
ArgParse a("");
|
||||
ArgParse a("A simple HTTP server that bites on Gitea webhooks.",
|
||||
"Homepage: http://matetelki.eu:3000/denes/webfish\n" \
|
||||
"Author: Denes Matetelki <denes@matetelki.com>"
|
||||
);
|
||||
a.addArgument("-p", "Listenning port (default is 5050)",
|
||||
ArgParse::ValueType::INT);
|
||||
a.addArgument("-f", "File to execute on receiving a POST message",
|
||||
ArgParse::ValueType::STRING,
|
||||
ArgParse::Required::REQUIRED,
|
||||
ArgParse::Required::REQUIRED);
|
||||
|
||||
try {
|
||||
a.parseArgs(argc, argv);
|
||||
} catch(...) {
|
||||
std::cerr << a.usage();
|
||||
std::cerr << a.usage() << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (a.foundArg("-h"))
|
||||
std::cout << a.usage() << std::endl;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
Loading…
Reference in new issue