88from plainbox .impl .secure .rfc822 import load_rfc822_records
99
1010
11+ def identity (value ):
12+ return value
13+
14+
1115def multiline_text (value ):
1216 # no more trailing spaces
1317 lines = (x .rstrip () for x in value .splitlines ())
@@ -261,6 +265,10 @@ def translate_options(value):
261265
262266
263267field_translators = {
268+ "command" : identity ,
269+ "Depends" : identity ,
270+ "Suggests" : identity ,
271+ "Recommends" : identity ,
264272 "id" : commentable_value ,
265273 "unit" : commentable_value ,
266274 "name" : commentable_value ,
@@ -269,17 +277,13 @@ def translate_options(value):
269277 "plugin" : commentable_value ,
270278 "category_id" : commentable_value ,
271279 "user" : commentable_value ,
272- "command" : commentable_value ,
273280 "value-type" : commentable_value ,
274281 "template-resource" : commentable_value ,
275282 "template-unit" : commentable_value ,
276283 "template-id" : commentable_value ,
277284 "template-engine" : commentable_value ,
278285 "entry_point" : commentable_value ,
279286 "file_extension" : commentable_value ,
280- "Depends" : commentable_value ,
281- "Suggests" : commentable_value ,
282- "Recommends" : commentable_value ,
283287 "os-version-id" : commentable_value ,
284288 "group" : commentable_value ,
285289 "description" : multiline_text ,
@@ -413,17 +417,22 @@ def invoked(self, ctx):
413417 loaded = load_rfc822_records (text , source = str (path ))
414418 documents = []
415419
420+ import sys
421+
416422 yaml = YAML ()
423+ yaml .width = 120
424+ yaml .default_flow_style = False
425+ yaml .representer .add_representer (str , multiline_str_representer )
426+ yaml .indent (mapping = 2 , sequence = 4 , offset = 2 )
427+
417428 for unit_dict in loaded :
418429 documents .append (translate_unit (unit_dict .data ))
430+ yaml .dump_all (documents , sys .stdout )
431+ breakpoint ()
419432
420433 header_comment = get_header_comment (text )
421434 if header_comment :
422435 documents [0 ].yaml_set_start_comment (header_comment )
423436
424- yaml .width = 120
425- yaml .default_flow_style = False
426- yaml .representer .add_representer (str , multiline_str_representer )
427- yaml .indent (mapping = 2 , sequence = 4 , offset = 2 )
428437 with path .with_suffix (".yaml" ).open ("w+" ) as f :
429438 yaml .dump_all (documents , f )
0 commit comments