Skip to content

Commit

Permalink
Add 'gap --version'
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin authored and ChrisJefferson committed Oct 8, 2020
1 parent 022d69b commit 22b45ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/system.g
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ BIND_GLOBAL( "GAPInfo", rec(
# for those options is correct
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( 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
11 changes: 11 additions & 0 deletions src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,16 @@ static Int enableMemCheck(Char ** argv, void * dummy)
#endif


static Int printVersion(Char ** argv, void * dummy)
{
SyFputs("GAP ", 1);
SyFputs(SyBuildVersion, 1);
SyFputs(" built on ", 1);
SyFputs(SyBuildDateTime, 1);
SyExit(0);
}


/* These are just the options that need kernel processing. Additional options will be
recognised and handled in the library */

Expand Down Expand Up @@ -674,6 +684,7 @@ static const struct optInfo options[] = {
{ 0 , "cover", enableCodeCoverageAtStartup, 0, 1}, /* enable code coverage at startup */
{ 0 , "quitonbreak", toggle, &SyQuitOnBreak, 0}, /* Quit GAP if we enter the break loop */
{ 0 , "enableMemCheck", enableMemCheck, 0, 0 },
{ 0 , "version", printVersion, 0, 0 },
{ 0, "", 0, 0, 0}};


Expand Down

0 comments on commit 22b45ea

Please sign in to comment.