##// END OF EJS Templates
formatter: add template support...
Matt Mackall -
r25513:0c6f9839 default
parent child Browse files
Show More
@@ -135,6 +135,15 class jsonformatter(baseformatter):
135 135 baseformatter.end(self)
136 136 self._ui.write("\n]\n")
137 137
138 class templateformatter(baseformatter):
139 def __init__(self, ui, topic, opts):
140 baseformatter.__init__(self, ui, topic, opts)
141 self._topic = topic
142 self._t = gettemplater(ui, topic, opts.get('template', ''))
143 def _showitem(self):
144 g = self._t(self._topic, **self._item)
145 self._ui.write(templater.stringify(g))
146
138 147 def lookuptemplate(ui, topic, tmpl):
139 148 # looks like a literal template?
140 149 if '{' in tmpl:
@@ -187,7 +196,7 def formatter(ui, topic, opts):
187 196 elif template == "debug":
188 197 return debugformatter(ui, topic, opts)
189 198 elif template != "":
190 raise util.Abort(_("custom templates not yet supported"))
199 return templateformatter(ui, topic, opts)
191 200 elif ui.configbool('ui', 'formatdebug'):
192 201 return debugformatter(ui, topic, opts)
193 202 elif ui.configbool('ui', 'formatjson'):
General Comments 0
You need to be logged in to leave comments. Login now