2023-06-16 22:38:10 +03:00
|
|
|
/**
|
2023-06-17 00:58:22 +03:00
|
|
|
* This file is a part of the UMSKT Project
|
2023-06-16 22:38:10 +03:00
|
|
|
*
|
2023-06-17 00:58:22 +03:00
|
|
|
* Copyleft (C) 2019-2023 UMSKT Contributors (et.al.)
|
2023-06-16 22:38:10 +03:00
|
|
|
*
|
|
|
|
* 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, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
|
|
|
* 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
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* @FileCreated by Andrew on 01/06/2023
|
|
|
|
* @Maintainer Neo
|
|
|
|
*/
|
2023-06-01 16:09:22 +03:00
|
|
|
|
|
|
|
#include "header.h"
|
2023-06-07 22:23:59 +03:00
|
|
|
#include "cli.h"
|
2023-06-01 16:09:22 +03:00
|
|
|
|
2023-06-07 01:04:39 +03:00
|
|
|
Options options;
|
2023-06-01 20:55:36 +03:00
|
|
|
|
2023-06-02 07:25:43 +03:00
|
|
|
int main(int argc, char *argv[]) {
|
2023-06-07 22:23:59 +03:00
|
|
|
if (!CLI::parseCommandLine(argc, argv, &options)) {
|
2023-06-07 01:04:39 +03:00
|
|
|
fmt::print("error parsing command line options\n");
|
2023-06-07 22:23:59 +03:00
|
|
|
CLI::showHelp(argv);
|
2023-06-05 18:43:31 +03:00
|
|
|
return !options.error ? 0 : 1;
|
2023-06-02 07:25:43 +03:00
|
|
|
}
|
|
|
|
|
2023-06-05 18:43:31 +03:00
|
|
|
json keys;
|
2023-06-07 01:04:39 +03:00
|
|
|
|
2023-06-07 22:23:59 +03:00
|
|
|
int status = CLI::validateCommandLine(&options, argv, &keys);
|
2023-06-07 01:04:39 +03:00
|
|
|
if (status > 0) {
|
|
|
|
return status;
|
2023-06-02 07:25:43 +03:00
|
|
|
}
|
|
|
|
|
2023-06-07 22:23:59 +03:00
|
|
|
CLI* run = new CLI(options, keys);
|
2023-06-01 16:09:22 +03:00
|
|
|
|
2023-06-07 22:23:59 +03:00
|
|
|
switch(options.applicationMode) {
|
2023-06-19 22:41:27 +03:00
|
|
|
case MODE_BINK1998_GENERATE:
|
|
|
|
return run->BINK1998Generate();
|
2023-06-01 22:19:35 +03:00
|
|
|
|
2023-06-19 22:41:27 +03:00
|
|
|
case MODE_BINK2002_GENERATE:
|
|
|
|
return run->BINK2002Generate();
|
|
|
|
|
|
|
|
case MODE_BINK1998_VALIDATE:
|
|
|
|
return run->BINK1998Validate();
|
|
|
|
|
|
|
|
case MODE_BINK2002_VALIDATE:
|
|
|
|
return run->BINK2002Validate();
|
2023-06-01 22:19:35 +03:00
|
|
|
|
2023-06-07 22:23:59 +03:00
|
|
|
case MODE_CONFIRMATION_ID:
|
|
|
|
return run->ConfirmationID();
|
2023-06-01 22:19:35 +03:00
|
|
|
|
2023-06-07 22:23:59 +03:00
|
|
|
default:
|
|
|
|
return 1;
|
2023-06-02 07:25:43 +03:00
|
|
|
}
|
2023-06-04 16:32:05 +03:00
|
|
|
}
|