From 9845608754e1c8447bf756e57080c1512bf6eb70 Mon Sep 17 00:00:00 2001 From: IgorekLoschinin <igor.loschinin2014@yandex.ru> Date: Mon, 26 Apr 2021 01:45:06 +0300 Subject: [PATCH] ref #51 Fixing: move the helpCall method into worker. --- src/CFixer/main.cpp | 30 ++-------------------- src/CopyrighFixer/CopyrighFixer/worker.cpp | 19 ++++++++++++++ src/CopyrighFixer/CopyrighFixer/worker.h | 5 ++++ 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/CFixer/main.cpp b/src/CFixer/main.cpp index 568888b..2ee7c56 100644 --- a/src/CFixer/main.cpp +++ b/src/CFixer/main.cpp @@ -8,44 +8,18 @@ #include <quasarapp.h> #include <iostream> -void helpCall(); int main(int argc, char *argv[]) { if (!QuasarAppUtils::Params::parseParams(argc, argv)) { - helpCall(); + return 1; } if (QuasarAppUtils::Params::isEndable("h") || QuasarAppUtils::Params::isEndable("help")) { - helpCall(); + return 0; } return 0; } - -/** - * @brief helpCall - a helper call that display infotmation - * about the arguments and how to use them - */ -void helpCall(){ - - QuasarAppUtils::Help::Charters help = { - { - "Part 0 General", { - {"h or help", "These arguments represent a helper call that describes the functionality of each method"}, - {"-sourceDir path/to/source/dir", "This arrgument sets path to the source directory. By default it is sourceDir = PWD"}, - {"-sign path/to/sign/file", "This argument sets path to the sign patern. This is a required argument"}, - {"-currentOwner ownerName", "This argument sets name of the current owner of the code."}, - } - } - }; - - help += QuasarAppUtils::Params::getparamsHelp(); - - QuasarAppUtils::Params::showHelp(help); - - exit(0); - -} diff --git a/src/CopyrighFixer/CopyrighFixer/worker.cpp b/src/CopyrighFixer/CopyrighFixer/worker.cpp index a34d696..771fabb 100644 --- a/src/CopyrighFixer/CopyrighFixer/worker.cpp +++ b/src/CopyrighFixer/CopyrighFixer/worker.cpp @@ -20,4 +20,23 @@ bool Worker::run() { return 1; } +void Worker::printHelp() const { + QuasarAppUtils::Help::Charters help = { + { + "Part 0 General", { + {"h or help", "These arguments represent a helper call that describes the functionality of each method"}, + {"-sourceDir path/to/source/dir", "This arrgument sets path to the source directory. By default it is sourceDir = PWD"}, + {"-sign path/to/sign/file", "This argument sets path to the sign patern. This is a required argument"}, + {"-currentOwner ownerName", "This argument sets name of the current owner of the code."}, + } + } + }; + + help += QuasarAppUtils::Params::getparamsHelp(); + + QuasarAppUtils::Params::showHelp(help); + + exit(0); +} + }; diff --git a/src/CopyrighFixer/CopyrighFixer/worker.h b/src/CopyrighFixer/CopyrighFixer/worker.h index 3dde9c5..fd77f22 100644 --- a/src/CopyrighFixer/CopyrighFixer/worker.h +++ b/src/CopyrighFixer/CopyrighFixer/worker.h @@ -26,6 +26,11 @@ public: */ bool run(); + /** + * @brief printHelp Display infotmation about the arguments and how to use them. + */ + void printHelp() const; + };