diff --git a/scripts/build.sh b/scripts/build.sh index 6887a47..1efc7d2 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -63,6 +63,8 @@ COMPILE_COMMANDS=( "$CXX_WITH_FLAGS src/tools/arraydump.cpp -I./include -Lbin/lib -l:file.so -l:cli.so -o bin/tools/arraydump" "$CXX_WITH_FLAGS src/tools/baseconvert.cpp -I./include -Lbin/lib -l:cli.so -o bin/tools/baseconvert" "$CXX_WITH_FLAGS -pthread src/tools/hexnet.cpp -I./include -Lbin/lib -l:cli.so -l:libsockpp.so -o bin/tools/hexnet" + "$CXX_WITH_FLAGS src/fossvg.cpp -I./include -Lbin/lib -l:cli.so -o bin/fossvg" + "$CXX_WITH_FLAGS src/fossvgd.cpp -I./include -Lbin/lib -l:cli.so -o bin/fossvgd" ) for command in ${!COMPILE_COMMANDS[@]}; do echo "${COMPILE_COMMANDS[command]}" diff --git a/setupenv.bashrc b/setupenv.bashrc index 6c0a6dc..a7718e3 100644 --- a/setupenv.bashrc +++ b/setupenv.bashrc @@ -41,7 +41,7 @@ function build { echo "Added aliases and functions." -export PATH="$PROJECT_BASE_DIR/bin/tools:$PROJECT_BASE_DIR/scripts/tools:$PATH" +export PATH="$PROJECT_BASE_DIR/bin:$PROJECT_BASE_DIR/bin/tools:$PROJECT_BASE_DIR/scripts/tools:$PATH" echo "PATH is $PATH" if [ -z "$LD_LIBRARY_PATH" ]; then diff --git a/src/fossvg.cpp b/src/fossvg.cpp new file mode 100644 index 0000000..c2df751 --- /dev/null +++ b/src/fossvg.cpp @@ -0,0 +1,67 @@ +// Copyright 2022, FOSS-VG Developers and Contributers +// +// Author(s): +// BodgeMaster +// +// This program is free software: you can redistribute it and/or modify it +// under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, version 3. +// +// This program 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// version 3 along with this program. +// If not, see https://www.gnu.org/licenses/agpl-3.0.en.html + +#include +#include + +#include "./lib/cli.hpp" + +#define EXIT_SUCCESS 0 +#define EXIT_RUNTIME 1 +#define EXIT_USAGE 2 + +int main(int argc, char* argv[]) { + std::vector flags; + flags.push_back(CLI::Flag('h', "help", "print help and exit")); + flags.push_back(CLI::Flag('l', "license", "print license information and exit")); + std::vector options; + std::vector arguments; + CLI::ArgumentsParser cliParser = CLI::ArgumentsParser(argc, argv, flags, options, arguments, "FOSS-VG Client"); + + if (cliParser.getFlag("help").value) { + std::cout << cliParser.getUsage() << std::endl; + return EXIT_SUCCESS; + } + + if (cliParser.getFlag("license").value){ + std::cout + << "Copyright 2022, FOSS-VG Developers and Contributers\n" + << "\n" + << "This program is free software: you can redistribute it and/or modify it\n" + << "under the terms of the GNU Affero General Public License as published\n" + << "by the Free Software Foundation, version 3.\n" + << "\n" + << "This program is distributed in the hope that it will be useful,\n" + << "but WITHOUT ANY WARRANTY; without even the implied\n" + << "warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" + << "See the GNU Affero General Public License for more details.\n" + << "\n" + << "You should have received a copy of the GNU Affero General Public License\n" + << "version 3 along with this program.\n" + << "If not, see https://www.gnu.org/licenses/agpl-3.0.en.html" + << std::endl; + return EXIT_SUCCESS; + } + + if (cliParser.wrongUsage) { + std::cout << cliParser.getUsage() << std::endl; + return EXIT_USAGE; + } + + return EXIT_SUCCESS; +} diff --git a/src/fossvgd.cpp b/src/fossvgd.cpp new file mode 100644 index 0000000..8c4c4a6 --- /dev/null +++ b/src/fossvgd.cpp @@ -0,0 +1,67 @@ +// Copyright 2022, FOSS-VG Developers and Contributers +// +// Author(s): +// BodgeMaster +// +// This program is free software: you can redistribute it and/or modify it +// under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, version 3. +// +// This program 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 Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// version 3 along with this program. +// If not, see https://www.gnu.org/licenses/agpl-3.0.en.html + +#include +#include + +#include "./lib/cli.hpp" + +#define EXIT_SUCCESS 0 +#define EXIT_RUNTIME 1 +#define EXIT_USAGE 2 + +int main(int argc, char* argv[]) { + std::vector flags; + flags.push_back(CLI::Flag('h', "help", "print help and exit")); + flags.push_back(CLI::Flag('l', "license", "print license information and exit")); + std::vector options; + std::vector arguments; + CLI::ArgumentsParser cliParser = CLI::ArgumentsParser(argc, argv, flags, options, arguments, "FOSS-VG Server"); + + if (cliParser.getFlag("help").value) { + std::cout << cliParser.getUsage() << std::endl; + return EXIT_SUCCESS; + } + + if (cliParser.getFlag("license").value){ + std::cout + << "Copyright 2022, FOSS-VG Developers and Contributers\n" + << "\n" + << "This program is free software: you can redistribute it and/or modify it\n" + << "under the terms of the GNU Affero General Public License as published\n" + << "by the Free Software Foundation, version 3.\n" + << "\n" + << "This program is distributed in the hope that it will be useful,\n" + << "but WITHOUT ANY WARRANTY; without even the implied\n" + << "warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" + << "See the GNU Affero General Public License for more details.\n" + << "\n" + << "You should have received a copy of the GNU Affero General Public License\n" + << "version 3 along with this program.\n" + << "If not, see https://www.gnu.org/licenses/agpl-3.0.en.html" + << std::endl; + return EXIT_SUCCESS; + } + + if (cliParser.wrongUsage) { + std::cout << cliParser.getUsage() << std::endl; + return EXIT_USAGE; + } + + return EXIT_SUCCESS; +}