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 --version #4126

Merged
merged 1 commit into from
Oct 8, 2020
Merged
Show file tree
Hide file tree
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
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