Skip to content

Commit

Permalink
Respect COLUMNS (ocaml-flambda#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshinwell authored Oct 25, 2021
1 parent 079445c commit 1274c22
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions driver/optmaindriver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ module Options = Main_args.Make_optcomp_options (Main_args.Default.Optmain)

let main argv ppf ~flambda2 =
native_code := true;
let columns =
match Sys.getenv "COLUMNS" with
| exception Not_found -> None
| columns ->
try Some (int_of_string columns)
with _ -> None
in
(match columns with
| None -> ()
| Some columns ->
(* Avoid getting too close to the edge just in case we've mismeasured
the boxes for some reason. *)
let columns = columns - 5 in
Format.pp_set_margin Format.std_formatter columns;
Format.pp_set_margin Format.err_formatter columns);
match
Compenv.readenv ppf Before_args;
Clflags.add_arguments __LOC__ (Arch.command_line_options @ Options.list);
Expand Down

0 comments on commit 1274c22

Please sign in to comment.