comparison 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
comparison
equal deleted inserted replaced
19424:762e51ce3411 19425:81fbd4e66ff5
1 """usage: %s DOC ...
2
3 where DOC is the name of a document
4 """
5
1 import os, sys, textwrap 6 import os, sys, textwrap
2 # import from the live mercurial repo 7 # import from the live mercurial repo
3 sys.path.insert(0, "..") 8 sys.path.insert(0, "..")
4 # fall back to pure modules if required C extensions are not available 9 # fall back to pure modules if required C extensions are not available
5 sys.path.append(os.path.join('..', 'mercurial', 'pure')) 10 sys.path.append(os.path.join('..', 'mercurial', 'pure'))
166 171
167 def allextensionnames(): 172 def allextensionnames():
168 return extensions.enabled().keys() + extensions.disabled().keys() 173 return extensions.enabled().keys() + extensions.disabled().keys()
169 174
170 if __name__ == "__main__": 175 if __name__ == "__main__":
171 showdoc(sys.stdout) 176 doc = 'hg.1.gendoc'
177 if len(sys.argv) > 1:
178 doc = sys.argv[1]
179
180 if doc == 'hg.1.gendoc':
181 showdoc(sys.stdout)
182 else:
183 showtopic(sys.stdout, sys.argv[1])