Mercurial > hg
comparison mercurial/commands.py @ 1049:160a68cd393f
Allow --help and --version being used together.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 26 Aug 2005 08:42:56 +0200 |
parents | 7fbb440b2e63 |
children | 9c09094de48c |
comparison
equal
deleted
inserted
replaced
1048:7fbb440b2e63 | 1049:160a68cd393f |
---|---|
267 "This is free software; see the source for copying conditions. " | 267 "This is free software; see the source for copying conditions. " |
268 "There is NO\nwarranty; " | 268 "There is NO\nwarranty; " |
269 "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" | 269 "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" |
270 ) | 270 ) |
271 | 271 |
272 def help_(ui, cmd=None): | 272 def help_(ui, cmd=None, with_version=False): |
273 """show help for a given command or all commands""" | 273 """show help for a given command or all commands""" |
274 if cmd and cmd != 'shortlist': | 274 if cmd and cmd != 'shortlist': |
275 if with_version: | |
276 show_version(ui) | |
277 ui.write('\n') | |
275 key, i = find(cmd) | 278 key, i = find(cmd) |
276 # synopsis | 279 # synopsis |
277 ui.write("%s\n\n" % i[2]) | 280 ui.write("%s\n\n" % i[2]) |
278 | 281 |
279 # description | 282 # description |
303 if c: | 306 if c: |
304 ui.write(' %s\n' % c) | 307 ui.write(' %s\n' % c) |
305 | 308 |
306 else: | 309 else: |
307 # program name | 310 # program name |
308 if ui.verbose: | 311 if ui.verbose or with_version: |
309 show_version(ui) | 312 show_version(ui) |
310 else: | 313 else: |
311 ui.status("Mercurial Distributed SCM\n") | 314 ui.status("Mercurial Distributed SCM\n") |
312 ui.status('\n') | 315 ui.status('\n') |
313 | 316 |
1632 not options["noninteractive"]) | 1635 not options["noninteractive"]) |
1633 | 1636 |
1634 try: | 1637 try: |
1635 try: | 1638 try: |
1636 if options['help']: | 1639 if options['help']: |
1637 help_(u, cmd) | 1640 help_(u, cmd, options['version']) |
1638 sys.exit(0) | 1641 sys.exit(0) |
1639 elif options['version']: | 1642 elif options['version']: |
1640 show_version(u) | 1643 show_version(u) |
1641 sys.exit(0) | 1644 sys.exit(0) |
1642 elif not cmd: | 1645 elif not cmd: |