Mercurial > public > mercurial-scm > hg
comparison mercurial/help.py @ 37134:6890b7e991a4
help: supporting both help and doc for aliases
This allows an alias to be definted like:
[alias]
lj = log -Tjson
lj:help = [-r REV]
lj:doc = Shows the revision log in JSON format.
Differential Revision: https://phab.mercurial-scm.org/D2678
author | Rodrigo Damazio <rdamazio@google.com> |
---|---|
date | Sun, 04 Mar 2018 17:11:33 -0500 |
parents | ef6215df2402 |
children | 6e526b0961a8 |
comparison
equal
deleted
inserted
replaced
37133:a2a6755a3def | 37134:6890b7e991a4 |
---|---|
368 if not doc: | 368 if not doc: |
369 doc = _("(no help text available)") | 369 doc = _("(no help text available)") |
370 if util.safehasattr(entry[0], 'definition'): # aliased command | 370 if util.safehasattr(entry[0], 'definition'): # aliased command |
371 source = entry[0].source | 371 source = entry[0].source |
372 if entry[0].definition.startswith('!'): # shell alias | 372 if entry[0].definition.startswith('!'): # shell alias |
373 doc = (_('shell alias for::\n\n %s\n\ndefined by: %s\n') % | 373 doc = (_('shell alias for: %s\n\n%s\n\ndefined by: %s\n') % |
374 (entry[0].definition[1:], source)) | 374 (entry[0].definition[1:], doc, source)) |
375 else: | 375 else: |
376 doc = (_('alias for: hg %s\n\n%s\n\ndefined by: %s\n') % | 376 doc = (_('alias for: hg %s\n\n%s\n\ndefined by: %s\n') % |
377 (entry[0].definition, doc, source)) | 377 (entry[0].definition, doc, source)) |
378 doc = doc.splitlines(True) | 378 doc = doc.splitlines(True) |
379 if ui.quiet or not full: | 379 if ui.quiet or not full: |