From: Adrián Arroyo Calle Date: Fri, 20 Aug 2021 12:15:16 +0000 (+0200) Subject: Read scryerrc if goals specified but not -f specified X-Git-Tag: v0.9.0~45^2~4 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=dce0c43e2609219a42ba561a918ef3f5f8c6fa57;p=scryer-prolog.git Read scryerrc if goals specified but not -f specified --- diff --git a/src/toplevel.pl b/src/toplevel.pl index cb12410a..2dc7abf0 100644 --- a/src/toplevel.pl +++ b/src/toplevel.pl @@ -10,6 +10,8 @@ :- use_module(library('$project_atts')). :- use_module(library('$atts')). +:- dynamic(custom_init_file/0). + load_scryerrc :- ( '$home_directory'(HomeDir) -> append(HomeDir, "./scryerrc", ScryerrcFile), @@ -35,6 +37,7 @@ load_init_file(ScryerrcFile) :- Args = Args0 ), delegate_task(Args, []), + (\+ custom_init_file -> load_scryerrc ; true), repl. '$repl'(_) :- ( \+ argv(_) -> asserta('$toplevel':argv([])) @@ -46,6 +49,7 @@ load_init_file(ScryerrcFile) :- delegate_task([], []). delegate_task([], Goals0) :- reverse(Goals0, Goals), + (\+ custom_init_file -> load_scryerrc ; true), run_goals(Goals), repl. @@ -89,12 +93,14 @@ gather_goal(Type, Args0, Goals) :- delegate_task(Args, [Gs|Goals]). init_file(Args0, Goals) :- + \+ custom_init_file, length(Args0, N), ( N < 1 -> print_help, halt ; true ), [File|Args] = Args0, load_init_file(File), + asserta('custom_init_file'), delegate_task(Args, Goals). arg_type(g).