[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
Tue Sep 17 02:26:30 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL372088: [llvm-ar] Parse 'h' and '-h': display help and exit (authored by MaskRay, committed by ).

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67560/new/

https://reviews.llvm.org/D67560

Files:
  llvm/trunk/test/tools/llvm-ar/help-message.test
  llvm/trunk/tools/llvm-ar/llvm-ar.cpp


Index: llvm/trunk/test/tools/llvm-ar/help-message.test
===================================================================
--- llvm/trunk/test/tools/llvm-ar/help-message.test
+++ llvm/trunk/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
Index: llvm/trunk/tools/llvm-ar/llvm-ar.cpp
===================================================================
--- llvm/trunk/tools/llvm-ar/llvm-ar.cpp
+++ llvm/trunk/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;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67560.220456.patch
Type: text/x-patch
Size: 1544 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190917/dc1f69d1/attachment.bin>


More information about the llvm-commits mailing list