[PATCH] D67560: [llvm-ar] Parse 'h' and '-h': display help and exit
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 14 08:06:13 PDT 2019
MaskRay updated this revision to Diff 220217.
MaskRay retitled this revision from "[llvm-ar] Add operation 'h': display help and exit" to "[llvm-ar] Parse 'h' and '-h': display help and exit".
MaskRay edited the summary of this revision.
MaskRay added a comment.
Parse -h (supported by GNU ar as well)
Address review comments
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67560/new/
https://reviews.llvm.org/D67560
Files:
test/tools/llvm-ar/help-message.test
tools/llvm-ar/llvm-ar.cpp
Index: tools/llvm-ar/llvm-ar.cpp
===================================================================
--- tools/llvm-ar/llvm-ar.cpp
+++ tools/llvm-ar/llvm-ar.cpp
@@ -70,14 +70,14 @@
llvm-ar -M [<mri-script]
OPTIONS:
- --format - Archive format to create
+ --format - archive format to create
=default - default
=gnu - gnu
=darwin - darwin
=bsd - bsd
- --plugin=<string> - Ignored for compatibility
- --help - Display available options
- --version - Display the version of this program
+ --plugin=<string> - ignored for compatibility
+ -h --help - display this help and exit
+ --version - print the version and exit
@<file> - read options from <file>
OPERATIONS:
@@ -1030,7 +1030,7 @@
}
static bool handleGenericOption(StringRef arg) {
- if (arg == "-help" || arg == "--help") {
+ if (arg == "h" || arg.startswith("-h") || arg == "--help") {
printHelpMessage();
return true;
}
Index: test/tools/llvm-ar/help-message.test
===================================================================
--- /dev/null
+++ test/tools/llvm-ar/help-message.test
@@ -0,0 +1,6 @@
+# RUN: llvm-ar h | FileCheck %s
+# RUN: llvm-ar -h | FileCheck %s
+# RUN: llvm-ar -help | FileCheck %s
+# RUN: llvm-ar --help | FileCheck %s
+
+# CHECK: USAGE: llvm-ar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67560.220217.patch
Type: text/x-patch
Size: 1451 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190914/0e3c763d/attachment.bin>
More information about the llvm-commits
mailing list