Skip to content

Commit

Permalink
Command line parameters for search paths (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bohun9 authored May 8, 2024
1 parent b6cf79a commit 56eec70
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/dbl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ let usage_string =

let args = ref []

let cli_lib_search_dirs = ref []
let cli_local_search_dirs = ref []

let include_cli_search_dirs () =
DblConfig.lib_search_dirs :=
List.rev_append !cli_lib_search_dirs !DblConfig.lib_search_dirs;
DblConfig.local_search_dirs :=
List.rev_append !cli_local_search_dirs !DblConfig.local_search_dirs

let cmd_args_options = Arg.align
[ "-args",
Arg.Rest (fun arg -> args := arg :: !args),
Expand All @@ -28,7 +37,15 @@ let cmd_args_options = Arg.align

"-verbose-internal-errors",
Arg.Set InterpLib.InternalError.verbose,
" Make internal errors more verbose (for debugging only)"
" Make internal errors more verbose (for debugging only)";

"-L",
Arg.String (fun p -> cli_lib_search_dirs := p :: !cli_lib_search_dirs),
" Add a path to library search directories";

"-I",
Arg.String (fun p -> cli_local_search_dirs := p :: !cli_local_search_dirs),
" Add a path to local search directories";
]

let fname = ref None
Expand All @@ -45,6 +62,7 @@ let proc_arg arg =

let _ =
Arg.parse cmd_args_options proc_arg usage_string;
include_cli_search_dirs ();
try
match !fname with
| None -> Pipeline.run_repl ()
Expand Down

0 comments on commit 56eec70

Please sign in to comment.