Merge pull request #68 from UMSKT/newline-fix

This commit is contained in:
TheTank20 2023-09-02 13:16:56 -04:00 committed by GitHub
commit 214d2d38a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 12 deletions

View File

@ -61,6 +61,7 @@ void CLI::showHelp(char *argv[]) {
fmt::print("\t-s --serial\tspecifies a serial to use in the product ID (defaults to random, BINK1998 only)\n");
fmt::print("\t-u --upgrade\tspecifies the Product Key will be an \"Upgrade\" version\n");
fmt::print("\t-V --validate\tproduct key to validate signature\n");
fmt::print("\t-N --nonewlines\tdisables newlines (for easier embedding in other apps)\n");
fmt::print("\n");
}
@ -81,13 +82,13 @@ int CLI::parseCommandLine(int argc, char* argv[], Options* options) {
false,
false,
false,
false,
MODE_BINK1998_GENERATE,
WINDOWS
};
for (int i = 1; i < argc; i++) {
std::string arg = argv[i];
if (arg == "-v" || arg == "--verbose") {
options->verbose = true;
UMSKT::setDebugOutput(stderr);
@ -193,6 +194,9 @@ int CLI::parseCommandLine(int argc, char* argv[], Options* options) {
options->keyToCheck = argv[i+1];
options->applicationMode = MODE_BINK1998_VALIDATE;
i++;
} else if (arg == "-N" || arg == "--nonewlines") {
options->nonewlines = true;
} else {
options->error = true;
}
@ -446,10 +450,9 @@ int CLI::BINK1998Generate() {
if (this->options.verbose) {
fmt::print("\nSuccess count: {}/{}", this->count, this->total);
}
#ifndef _WIN32
if (this->options.nonewlines == false) {
fmt::print("\n");
#endif
}
return 0;
}
@ -495,9 +498,9 @@ int CLI::BINK2002Generate() {
if (this->options.verbose) {
fmt::print("\nSuccess count: {}/{}", this->count, this->total);
}
#ifndef _WIN32
if (this->options.nonewlines == false) {
fmt::print("\n");
#endif
}
return 0;
}
@ -571,9 +574,9 @@ int CLI::ConfirmationID() {
case SUCCESS:
fmt::print(confirmation_id);
#ifndef _WIN32
if (this->options.nonewlines == false) {
fmt::print("\n");
#endif
}
return 0;
default:

View File

@ -67,6 +67,7 @@ struct Options {
bool help;
bool error;
bool list;
bool nonewlines;
MODE applicationMode;
ACTIVATION_ALGORITHM activationMode;