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