##// END OF EJS Templates
config: add support for defaultvalue of list of printable elements
Yuya Nishihara -
r43644:a71578ec stable
parent child Browse files
Show More
@@ -2269,6 +2269,10 b' def config(ui, repo, *values, **opts):'
2269 2269 fm.write(b'name value', b'%s=%s\n', entryname, value)
2270 2270 if formatter.isprintable(defaultvalue):
2271 2271 fm.data(defaultvalue=defaultvalue)
2272 elif isinstance(defaultvalue, list) and all(
2273 formatter.isprintable(e) for e in defaultvalue
2274 ):
2275 fm.data(defaultvalue=fm.formatlist(defaultvalue, name=b'value'))
2272 2276 # TODO: no idea how to process unsupported defaultvalue types
2273 2277 matched = True
2274 2278 fm.end()
@@ -186,6 +186,7 b' Test config default of various types:'
186 186 $ hg config --config commands.show.aliasprefix= commands -Tjson
187 187 [
188 188 {
189 "defaultvalue": [],
189 190 "name": "commands.show.aliasprefix",
190 191 "source": "--config",
191 192 "value": ""
@@ -193,7 +194,7 b' Test config default of various types:'
193 194 ]
194 195 $ hg config --config commands.show.aliasprefix= commands -T'json(defaultvalue)'
195 196 [
196 {"defaultvalue": ""}
197 {"defaultvalue": []}
197 198 ]
198 199 $ hg config --config commands.show.aliasprefix= commands -T'{defaultvalue}\n'
199 200
@@ -203,6 +204,7 b' Test config default of various types:'
203 204 $ hg config --config progress.format= progress -Tjson
204 205 [
205 206 {
207 "defaultvalue": ["topic", "bar", "number", "estimate"],
206 208 "name": "progress.format",
207 209 "source": "--config",
208 210 "value": ""
@@ -210,10 +212,10 b' Test config default of various types:'
210 212 ]
211 213 $ hg config --config progress.format= progress -T'json(defaultvalue)'
212 214 [
213 {"defaultvalue": ""}
215 {"defaultvalue": ["topic", "bar", "number", "estimate"]}
214 216 ]
215 217 $ hg config --config progress.format= progress -T'{defaultvalue}\n'
216
218 topic bar number estimate
217 219
218 220 int
219 221
General Comments 0
You need to be logged in to leave comments. Login now