'catala depends': allow multiple extensions

This commit is contained in:
Louis Gesbert 2024-03-19 15:25:54 +01:00
parent 619cafebb8
commit adaaf735e6
2 changed files with 10 additions and 7 deletions

View File

@ -396,9 +396,11 @@ module Flags = struct
let extension =
value
& opt (some string) None
& opt_all string []
& info ["extension"; "e"] ~docv:"EXT"
~doc:"Replace the original file extensions with $(i,.EXT)."
~doc:
"Replace the original file extensions with $(i,.EXT). If repeated, \
the file will be listed once which each supplied extension."
let prefix =
value

View File

@ -1053,11 +1053,12 @@ module Commands = struct
f)
else File.(pfx / f)
in
let f =
File.clean_path
@@ match extension with None -> f | Some ext -> File.(f -.- ext)
in
Format.pp_print_string ppf f)
let f = File.clean_path f in
if extension = [] then Format.pp_print_string ppf f
else
Format.pp_print_list ~pp_sep:Format.pp_print_space
(fun ppf ext -> Format.pp_print_string ppf File.(f -.- ext))
ppf extension)
Format.std_formatter modules_list_topo;
Format.close_box ();
Format.print_newline ()