add the -require command line argument
This commit is contained in:
parent
cc49fa8dc9
commit
578c3771c5
|
@ -23,6 +23,9 @@ val keywords : Set.Make(String).t ref
|
||||||
val add_keyword : string -> unit
|
val add_keyword : string -> unit
|
||||||
(** Add a new OCaml keyword. *)
|
(** Add a new OCaml keyword. *)
|
||||||
|
|
||||||
|
val require : string list -> unit
|
||||||
|
(** Load all the given findlib packages *)
|
||||||
|
|
||||||
type ui = Console | Emacs
|
type ui = Console | Emacs
|
||||||
(** The user interface in use. *)
|
(** The user interface in use. *)
|
||||||
|
|
||||||
|
@ -298,6 +301,8 @@ val discard_formatters : Format.formatter list -> (unit -> 'a) -> 'a
|
||||||
(** [discard_formatters pps f] executes [f], dropping everything it
|
(** [discard_formatters pps f] executes [f], dropping everything it
|
||||||
prints on [pps]. *)
|
prints on [pps]. *)
|
||||||
|
|
||||||
|
val split_words : string -> string list
|
||||||
|
|
||||||
(**/**)
|
(**/**)
|
||||||
|
|
||||||
(* These variables are not used and deprecated: *)
|
(* These variables are not used and deprecated: *)
|
||||||
|
|
|
@ -1052,6 +1052,9 @@ let print_version_num () =
|
||||||
(* Config from command line *)
|
(* Config from command line *)
|
||||||
let autoload = ref true
|
let autoload = ref true
|
||||||
|
|
||||||
|
(* Packages to load at startup *)
|
||||||
|
let requires = ref []
|
||||||
|
|
||||||
let args = Arg.align [
|
let args = Arg.align [
|
||||||
#if ocaml_version >= (3, 13, 0)
|
#if ocaml_version >= (3, 13, 0)
|
||||||
"-absname", Arg.Set Location.absname, " Show absolute filenames in error message";
|
"-absname", Arg.Set Location.absname, " Show absolute filenames in error message";
|
||||||
|
@ -1098,6 +1101,8 @@ let args = Arg.align [
|
||||||
" Show identifiers starting with a '_'";
|
" Show identifiers starting with a '_'";
|
||||||
"-no-autoload", Arg.Clear autoload,
|
"-no-autoload", Arg.Clear autoload,
|
||||||
" Disable autoloading of files in $OCAML_TOPLEVEL_PATH/autoload";
|
" Disable autoloading of files in $OCAML_TOPLEVEL_PATH/autoload";
|
||||||
|
"-require", Arg.String (fun s -> requires := !requires @ UTop.split_words s),
|
||||||
|
"<package> Load this package";
|
||||||
]
|
]
|
||||||
|
|
||||||
#if ocaml_version >= (4, 01, 0)
|
#if ocaml_version >= (4, 01, 0)
|
||||||
|
@ -1124,6 +1129,8 @@ let common_init () =
|
||||||
Location.input_name := UTop.input_name;
|
Location.input_name := UTop.input_name;
|
||||||
(* Make sure SIGINT is catched while executing OCaml code. *)
|
(* Make sure SIGINT is catched while executing OCaml code. *)
|
||||||
Sys.catch_break true;
|
Sys.catch_break true;
|
||||||
|
(* Requires *)
|
||||||
|
UTop.require !requires;
|
||||||
(* Load system init files. *)
|
(* Load system init files. *)
|
||||||
(match try Some (Sys.getenv "OCAML_TOPLEVEL_PATH") with Not_found -> None with
|
(match try Some (Sys.getenv "OCAML_TOPLEVEL_PATH") with Not_found -> None with
|
||||||
| Some dir ->
|
| Some dir ->
|
||||||
|
|
Loading…
Reference in New Issue