r366828 - Improve clang-format-diff help output

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 23 10:34:18 PDT 2019


Author: nico
Date: Tue Jul 23 10:34:18 2019
New Revision: 366828

URL: http://llvm.org/viewvc/llvm-project?rev=366828&view=rev
Log:
Improve clang-format-diff help output

The description in clang-format-diff.py is more useful than the one
in `clang-format-diff -h`, so use the same description in both places.

Differential Revision: https://reviews.llvm.org/D64998

Modified:
    cfe/trunk/tools/clang-format/clang-format-diff.py

Modified: cfe/trunk/tools/clang-format/clang-format-diff.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/clang-format-diff.py?rev=366828&r1=366827&r2=366828&view=diff
==============================================================================
--- cfe/trunk/tools/clang-format/clang-format-diff.py (original)
+++ cfe/trunk/tools/clang-format/clang-format-diff.py Tue Jul 23 10:34:18 2019
@@ -8,10 +8,7 @@
 #
 #===------------------------------------------------------------------------===#
 
-r"""
-ClangFormat Diff Reformatter
-============================
-
+"""
 This script reads input from a unified diff and reformats all the changed
 lines. This is useful to reformat all the lines touched by a specific patch.
 Example usage for git/svn users:
@@ -35,10 +32,9 @@ else:
 
 
 def main():
-  parser = argparse.ArgumentParser(description=
-                                   'Reformat changed lines in diff. Without -i '
-                                   'option just output the diff that would be '
-                                   'introduced.')
+  parser = argparse.ArgumentParser(description=__doc__,
+                                   formatter_class=
+                                           argparse.RawDescriptionHelpFormatter)
   parser.add_argument('-i', action='store_true', default=False,
                       help='apply edits to files instead of displaying a diff')
   parser.add_argument('-p', metavar='NUM', default=0,




More information about the cfe-commits mailing list