+## Show that the help message for llvm-ar can be printed with either the long
+## flag -help or with the h modifier.
+
# RUN: llvm-ar h | FileCheck %s
+# RUN: llvm-ar xh | FileCheck %s
# RUN: llvm-ar -h | FileCheck %s
+# RUN: llvm-ar -xh | FileCheck %s
# RUN: llvm-ar -help | FileCheck %s
# RUN: llvm-ar --help | FileCheck %s
--- /dev/null
+## Show that the version for llvm-ar can be printed with either the long flag
+## -version or with the V modifier.
+
+RUN: llvm-ar V | FileCheck %s
+RUN: llvm-ar xV | FileCheck %s
+RUN: llvm-ar -V | FileCheck %s
+RUN: llvm-ar -xV | FileCheck %s
+RUN: llvm-ar -version | FileCheck %s
+RUN: llvm-ar --version | FileCheck %s
+
+CHECK: version
[b] - put [files] before [relpos] (same as [i])
[c] - do not warn if archive had to be created
[D] - use zero for timestamps and uids/gids (default)
+ [h] - display this help and exit
[i] - put [files] before [relpos] (same as [b])
[l] - ignored for compatibility
[L] - add archive's contents
[u] - update only [files] newer than archive contents
[U] - use actual timestamps and uids/gids
[v] - be verbose about actions taken
+ [V] - display the version and exit
)";
void printHelpMessage() {
case 'L':
AddLibrary = true;
break;
+ case 'V':
+ cl::PrintVersionMessage();
+ exit(0);
+ case 'h':
+ printHelpMessage();
+ exit(0);
default:
fail(std::string("unknown option ") + Options[i]);
}
}
static bool handleGenericOption(StringRef arg) {
- if (arg == "h" || arg.startswith("-h") || arg == "--help") {
+ if (arg == "-help" || arg == "--help") {
printHelpMessage();
return true;
}