Skip to content

Commit eac4b98

Browse files
authored
Fixes to CLI error messages (#891)
Fixes #867. CTS PR: KhronosGroup/KTX-Software-CTS#24
1 parent e7d2d71 commit eac4b98

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

tools/ktx/ktx_main.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class Tools : public Command {
100100

101101
int Tools::main(int argc, char* argv[]) {
102102
cxxopts::Options options("ktx", "");
103-
options.custom_help("[--version] [--help] <command> <command-args>");
103+
options.custom_help("[<command>] [OPTION...]");
104104
options.set_width(CONSOLE_USAGE_WIDTH);
105105
options.add_options()
106106
("h,help", "Print this usage message and exit")
@@ -135,7 +135,11 @@ int Tools::main(int argc, char* argv[]) {
135135
fmt::print(std::cerr, "{}: Missing command.\n", options.program());
136136
printUsage(std::cerr, options);
137137
} else {
138-
fmt::print(std::cerr, "{}: Unrecognized command: \"{}\"\n", options.program(), args.unmatched()[0]);
138+
if (argv[1][0] != '-') {
139+
fmt::print(std::cerr, "{}: Unrecognized command: \"{}\"\n", options.program(), argv[1]);
140+
} else {
141+
fmt::print(std::cerr, "{}: Unrecognized argument: \"{}\"\n", options.program(), args.unmatched()[0]);
142+
}
139143
printUsage(std::cerr, options);
140144
}
141145

0 commit comments

Comments
 (0)