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