Add -q option to suppress banner.
To minimize output when running tests. Change-Id: Ia97c93cae31722d780ebf9714c6e508bb1630274
This commit is contained in:
@@ -7,7 +7,7 @@ prolog-shell - Simple interactive Prolog interpreter
|
||||
[verse]
|
||||
--
|
||||
_java_ -jar gerrit.war _prolog-shell_
|
||||
[-s FILE.pl ...]
|
||||
[-q] [-s FILE.pl ...]
|
||||
--
|
||||
|
||||
== DESCRIPTION
|
||||
@@ -15,6 +15,8 @@ Provides a simple interactive Prolog interpreter for development
|
||||
and testing.
|
||||
|
||||
== OPTIONS
|
||||
-q::
|
||||
Do not display banner.
|
||||
-s::
|
||||
Dynamically load the Prolog source code at startup,
|
||||
as though the user had entered `['FILE.pl'].` into
|
||||
|
@@ -30,9 +30,14 @@ public class PrologShell extends AbstractProgram {
|
||||
@Option(name = "-s", metaVar = "FILE.pl", usage = "file to load")
|
||||
private List<String> fileName = new ArrayList<>();
|
||||
|
||||
@Option(name = "-q", usage = "quiet mode without banner")
|
||||
private boolean quiet;
|
||||
|
||||
@Override
|
||||
public int run() {
|
||||
banner();
|
||||
if (!quiet) {
|
||||
banner();
|
||||
}
|
||||
|
||||
BufferingPrologControl pcl = new BufferingPrologControl();
|
||||
pcl.setPrologClassLoader(new PrologClassLoader(getClass().getClassLoader()));
|
||||
@@ -55,7 +60,9 @@ public class PrologShell extends AbstractProgram {
|
||||
|
||||
try {
|
||||
pcl.execute(Prolog.BUILTIN, "cafeteria");
|
||||
write("% halt\n");
|
||||
if (!quiet) {
|
||||
write("% halt\n");
|
||||
}
|
||||
return 0;
|
||||
} catch (HaltException halt) {
|
||||
write("% halt(" + halt.getStatus() + ")\n");
|
||||
|
Reference in New Issue
Block a user