Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command line option --print-gaproot #4465

Merged
merged 2 commits into from
May 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lib/system.g
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ BIND_GLOBAL( "GAPInfo", rec(
CommandLineOptionData := [
rec( short:= "h", long := "help", default := false, help := ["print this help and exit"] ),
rec( long := "version", default := false, help := ["print the GAP version and exit"] ),
rec( long := "print-gaproot", default := false, help := ["print the primary GAP root and exit"] ),
rec( short:= "b", long := "banner", default := false, help := ["disable/enable the banner"] ),
rec( short:= "q", long := "quiet", default := false, help := ["enable/disable quiet mode"] ),
rec( short:= "e", default := false, help := ["disable/enable quitting on <ctrl>-D"] ),
Expand Down Expand Up @@ -485,6 +486,20 @@ CallAndInstallPostRestore( function()
"\n" );
QuitGap();
fi;

# Evaluate the '--print-gaproot' option.
if GAPInfo.CommandLineOptions.( "print-gaproot" ) then
for line in GAPInfo.RootPaths do
value:= SHALLOW_COPY_OBJ( line );
APPEND_LIST_INTR( value, "sysinfo.gap" );
if IsExistingFile( value ) then
PRINT_TO( "*stdout*", line );
QuitGap(0);
fi;
od;
PRINT_TO( "*errout*", "failed to determine primary GAP root" );
QuitGap(1);
fi;
end );


Expand Down