[viewvc-dev] [PATCH] show usage documentation for "standalone.py --help"
Prabhu Gnana Sundar <[email protected]> Thu, 12 May 2011 17:44:19 +0530
| Newsgroups | gmane.comp.version-control.cvs.viewcvs.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all,
Currently, "standalone.py --help" shows the usage documentaion
*but with an error message*.
Attached a patch with this mail which would display the usage
documentation without the error
message for "standalone.py --help". Also attached is the log message.
Thanks and regards
Prabhu
------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4251&dsMessageId=2735002
To unsubscribe from this discussion, e-mail: [[email protected]].
viewvc_help.patch
(text/x-patch, 1.5 KB)
Index: bin/standalone.py
===================================================================
--- bin/standalone.py (revision 2558)
+++ bin/standalone.py (working copy)
@@ -444,6 +444,7 @@
'port=',
'repository=',
'script-alias=',
+ 'help',
]
try:
@@ -458,6 +459,8 @@
options.repositories["Development"] = val
elif opt in ('-d', '--daemon'):
options.daemon = 1
+ elif opt in ('--help'):
+ usage()
elif opt in ('-p', '--port'):
try:
options.port = int(val)
@@ -498,13 +501,15 @@
serve(options.host, options.port, ready)
return
except (getopt.error, BadUsage), err:
- cmd = os.path.basename(sys.argv[0])
- port = options.port
- host = options.host
- script_alias = options.script_alias
if str(err):
sys.stderr.write("ERROR: %s\n\n" % (str(err)))
- sys.stderr.write("""Usage: %(cmd)s [OPTIONS]
+ usage()
+def usage ():
+ cmd = os.path.basename(sys.argv[0])
+ port = options.port
+ host = options.host
+ script_alias = options.script_alias
+ sys.stderr.write("""Usage: %(cmd)s [OPTIONS]
Run a simple, standalone HTTP server configured to serve up ViewVC
requests.
@@ -541,6 +546,7 @@
an Apache htpasswd file that employs CRYPT
encryption. (Sorry, no DIGEST support yet.)
""" % locals())
+ sys.exit()
if __name__ == '__main__':
options = Options()
viewvc_help.log
(text/x-log, 355 B)
Display the "Usage" documentation without displaying it as an *error* for
the "standalone.py --help" option.
* bin/standalone.py
(main): Added "help" into long_opts. Handle the "--help" option to show the
"usage" documentation.
(usage): new function to display the documentation.
Patch by: Prabhu Gnana Sundar <prabhugs{_AT_}collab.net>