diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 8cbc307de0221f84c80c42dcbe07d40727537e2c (patch) | |
tree | 625d5a673015d1df891e051033e9fcde5c7be4e5 /library/cpp/getopt/small/opt2.cpp | |
parent | 30d1ef3941e0dc835be7609de5ebee66958f215a (diff) | |
download | ydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/getopt/small/opt2.cpp')
-rw-r--r-- | library/cpp/getopt/small/opt2.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/library/cpp/getopt/small/opt2.cpp b/library/cpp/getopt/small/opt2.cpp index 0cdc774e78..c3316ffe04 100644 --- a/library/cpp/getopt/small/opt2.cpp +++ b/library/cpp/getopt/small/opt2.cpp @@ -272,16 +272,16 @@ int Opt2::AutoUsage(const char* free_arg_names) { fprintf(where, "Usage: %s%s%s%s%s%s%s%s\n", prog, req ? " -" : "", req_str, nreq ? " [-" : "", nreq_str, nreq ? "]" : "", free_arg_names && *free_arg_names ? " " : "", free_arg_names); - for (auto& spec : Specs) { + for (auto& spec : Specs) { const char* hlp = !spec.HelpUsage.empty() ? spec.HelpUsage.data() : spec.HasArg ? "<arg>" : ""; - if (!spec.HasArg || spec.IsRequired) - fprintf(where, " -%c %s\n", spec.opt, hlp); - else if (!spec.IsNumeric) - fprintf(where, " -%c %s [Default: %s]\n", spec.opt, hlp, spec.DefValue); + if (!spec.HasArg || spec.IsRequired) + fprintf(where, " -%c %s\n", spec.opt, hlp); + else if (!spec.IsNumeric) + fprintf(where, " -%c %s [Default: %s]\n", spec.opt, hlp, spec.DefValue); else - fprintf(where, " -%c %s [Def.val: %li]\n", spec.opt, hlp, (long)(uintptr_t)spec.DefValue); - if (spec.LongOptName) - fprintf(where, " --%s%s - same as -%c\n", spec.LongOptName, spec.HasArg ? "=<argument>" : "", spec.opt); + fprintf(where, " -%c %s [Def.val: %li]\n", spec.opt, hlp, (long)(uintptr_t)spec.DefValue); + if (spec.LongOptName) + fprintf(where, " --%s%s - same as -%c\n", spec.LongOptName, spec.HasArg ? "=<argument>" : "", spec.opt); } if (OptionMissingArg) fprintf(where, " *** Option '%c' is missing required argument\n", OptionMissingArg); @@ -300,7 +300,7 @@ int Opt2::AutoUsage(const char* free_arg_names) { fprintf(where, " *** %i free argument(s) supplied, expected %i to %i\n", (int)Pos.size(), MinArgs, MaxArgs); if (BadPosCount && MinArgs == MaxArgs) fprintf(where, " *** %i free argument(s) supplied, expected %i\n", (int)Pos.size(), MinArgs); - for (const auto& userErrorMessage : UserErrorMessages) + for (const auto& userErrorMessage : UserErrorMessages) fprintf(where, " *** %s\n", userErrorMessage.data()); return UnknownOption == '?' ? 1 : 2; } |