From 6a79aebec3be47dd0eeac4038cfddafd5a6d0c02 Mon Sep 17 00:00:00 2001 From: Peter M. Groen Date: Tue, 2 Jul 2024 18:38:57 +0200 Subject: [PATCH] setting up the publish_cli --- tools/publish_cli/argumentparser.cpp | 0 tools/publish_cli/argumentparser.h | 0 tools/publish_cli/filereader.h | 38 ++++++++++++++++++++++++++++++++++++++ tools/publish_cli/main.cpp | 28 ++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 0 deletions(-) create mode 100644 tools/publish_cli/argumentparser.cpp create mode 100644 tools/publish_cli/argumentparser.h create mode 100644 tools/publish_cli/filereader.h create mode 100644 tools/publish_cli/main.cpp diff --git a/tools/publish_cli/argumentparser.cpp b/tools/publish_cli/argumentparser.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tools/publish_cli/argumentparser.cpp diff --git a/tools/publish_cli/argumentparser.h b/tools/publish_cli/argumentparser.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tools/publish_cli/argumentparser.h diff --git a/tools/publish_cli/filereader.h b/tools/publish_cli/filereader.h new file mode 100644 index 0000000..b26e9b1 --- /dev/null +++ b/tools/publish_cli/filereader.h @@ -0,0 +1,38 @@ +/* **************************************************************************** + * Copyright 2024 Open Systems Development BV * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the "Software"), * + * to deal in the Software without restriction, including without limitation * + * the rights to use, copy, modify, merge, publish, distribute, sublicense, * + * and/or sell copies of the Software, and to permit persons to whom the * + * Software is furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included in * + * all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * + * DEALINGS IN THE SOFTWARE. * + * ***************************************************************************/ +#pragma once + +class FileReader +{ + public: + static std::string read_file(const std::string &file_name) + { + std::ifstream file(file_name); + if (!file.is_open()) + { + throw std::runtime_error("Could not open file: " + file_name); + } + + std::string content((std::istreambuf_iterator(file)), std::istreambuf_iterator()); + return content; + } +} \ No newline at end of file diff --git a/tools/publish_cli/main.cpp b/tools/publish_cli/main.cpp new file mode 100644 index 0000000..88eaceb --- /dev/null +++ b/tools/publish_cli/main.cpp @@ -0,0 +1,28 @@ +/* **************************************************************************** + * Copyright 2024 Open Systems Development BV * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the "Software"), * + * to deal in the Software without restriction, including without limitation * + * the rights to use, copy, modify, merge, publish, distribute, sublicense, * + * and/or sell copies of the Software, and to permit persons to whom the * + * Software is furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included in * + * all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * + * DEALINGS IN THE SOFTWARE. * + * ***************************************************************************/ +#include + +int main(int argc, char* argv[]) +{ + std::cout << "Hello, World!" << std::endl; + return 0; +} \ No newline at end of file -- libgit2 0.21.4