summaryrefslogtreecommitdiff
path: root/src/validate_value.ml
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2026-03-10 13:21:01 -0500
committerJohn Estabrook <jestabro@vyos.io>2026-03-11 10:23:58 -0500
commitb67eaf59e5207473d62fc7dd6739ffc7602f8938 (patch)
tree3988aac2c6df5a438432f5ce29b29512db2111dc /src/validate_value.ml
parent1a600be86bc5739195533c2eb92bd35454354559 (diff)
downloadvyos-1x-b67eaf59e5207473d62fc7dd6739ffc7602f8938.tar.gz
vyos-1x-b67eaf59e5207473d62fc7dd6739ffc7602f8938.zip
T8269: add option to silence output of individual validators
Diffstat (limited to 'src/validate_value.ml')
-rw-r--r--src/validate_value.ml5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/validate_value.ml b/src/validate_value.ml
index 1d3450fd9..ce4755f2c 100644
--- a/src/validate_value.ml
+++ b/src/validate_value.ml
@@ -4,6 +4,7 @@ type check = Regex of string | Exec of string | Group of check list
let options = ref []
let checks = ref []
let value = ref ""
+let silent = ref false
let buf = Buffer.create 4096
@@ -36,6 +37,7 @@ let args = [
("--regex", Arg.String (fun s -> options := (RegexOpt s) :: !options), "Check the value against a regex");
("--exec", Arg.String (fun s -> options := (ExecOpt s) :: !options), "Check the value against an external command");
("--grp", Arg.Unit (fun () -> options := (GroupSeparator) :: !options), "Group following arguments, combining results with logical and");
+ ("--silent", Arg.Unit (fun () -> silent := true), "Suppress individual validator output");
("--value", Arg.String (fun s -> value := s), "Value to check");
]
let usage = Printf.sprintf "Usage: %s [OPTIONS] <number>" Sys.argv.(0)
@@ -105,5 +107,6 @@ let _ =
(* If we got this far, value validation failed.
Show the user output from the validators.
*)
- Buffer.contents buf |> print_endline;
+ if not !silent then Buffer.contents buf |> print_endline
+ else ();
exit 1