Mercurial > hg
comparison mercurial/templatekw.py @ 34993:625d5ebce066
templatekw: add verbosity keyword to select template by -q/-v/--debug flag
This can be used in conjunction with the ifeq() function.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 21 Oct 2017 17:46:41 +0900 |
parents | e2fc6cec0eff |
children | 6fe99a8e266d |
comparison
equal
deleted
inserted
replaced
34992:e2fc6cec0eff | 34993:625d5ebce066 |
---|---|
883 """ | 883 """ |
884 args = pycompat.byteskwargs(args) | 884 args = pycompat.byteskwargs(args) |
885 return showlist('instability', args['ctx'].instabilities(), args, | 885 return showlist('instability', args['ctx'].instabilities(), args, |
886 plural='instabilities') | 886 plural='instabilities') |
887 | 887 |
888 @templatekeyword('verbosity') | |
889 def showverbosity(ui, **args): | |
890 """String. The current output verbosity in 'debug', 'quiet', 'verbose', | |
891 or ''.""" | |
892 # see cmdutil.changeset_templater for priority of these flags | |
893 if ui.debugflag: | |
894 return 'debug' | |
895 elif ui.quiet: | |
896 return 'quiet' | |
897 elif ui.verbose: | |
898 return 'verbose' | |
899 return '' | |
900 | |
888 def loadkeyword(ui, extname, registrarobj): | 901 def loadkeyword(ui, extname, registrarobj): |
889 """Load template keyword from specified registrarobj | 902 """Load template keyword from specified registrarobj |
890 """ | 903 """ |
891 for name, func in registrarobj._table.iteritems(): | 904 for name, func in registrarobj._table.iteritems(): |
892 keywords[name] = func | 905 keywords[name] = func |