Skip to content
Snippets Groups Projects
Commit 490ec6c7 authored by Andre Maroneze's avatar Andre Maroneze Committed by Virgile Prevosto
Browse files

[MdR] use report kind to set output extension

parent 52d32d5c
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,8 @@
(* *)
(**************************************************************************)
module Pervasives_string = String
include Plugin.Register(
struct
let name = "Markdown report"
......@@ -27,14 +29,6 @@ include Plugin.Register(
let help = "generates a report in markdown format"
end)
module Output = String(
struct
let option_name = "-mdr-out"
let arg_name = "f"
let default = "report.md"
let help = "sets the name of the output file to <f>"
end)
module Generate = String(
struct
let option_name = "-mdr-gen"
......@@ -45,6 +39,26 @@ module Generate = String(
none (default), md, draft and sarif"
end)
module Output : Parameter_sig.String =
struct
include String(
struct
let option_name = "-mdr-out"
let arg_name = "f"
let default = "report"
let help = "sets the name of the output file to <f>.@ \
If <f> has no extension, it is chosen automatically based on \
the report kind"
end)
let get () =
let s = get () in
if Pervasives_string.contains (Filename.basename s) '.' then s
else
let kind = Generate.get () in
let ext = if kind = "sarif" then ".sarif" else ".md" in
s ^ ext
end
let () =
Generate.set_possible_values [ "none"; "md"; "draft"; "sarif" ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment