diff doc/gendoc.py @ 19425:81fbd4e66ff5

gendoc: dispatch print document content by commandline arguments Before this patch, gendoc.py only prints hg.1.gendoc.txt content. This adds any content print function.
author Takumi IINO <trot.thunder@gmail.com>
date Wed, 03 Jul 2013 21:49:41 +0900
parents 762e51ce3411
children 93f9d11603d8
line wrap: on
line diff
--- a/doc/gendoc.py	Wed Jul 03 21:49:39 2013 +0900
+++ b/doc/gendoc.py	Wed Jul 03 21:49:41 2013 +0900
@@ -1,3 +1,8 @@
+"""usage: %s DOC ...
+
+where DOC is the name of a document
+"""
+
 import os, sys, textwrap
 # import from the live mercurial repo
 sys.path.insert(0, "..")
@@ -168,4 +173,11 @@
     return extensions.enabled().keys() + extensions.disabled().keys()
 
 if __name__ == "__main__":
-    showdoc(sys.stdout)
+    doc = 'hg.1.gendoc'
+    if len(sys.argv) > 1:
+        doc = sys.argv[1]
+
+    if doc == 'hg.1.gendoc':
+        showdoc(sys.stdout)
+    else:
+        showtopic(sys.stdout, sys.argv[1])