diff options
author | Peter Wu <peter@lekensteyn.nl> | 2015-04-02 10:38:32 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2015-04-02 10:38:32 +0200 |
commit | d5979ace2a56e6333d4c0e304c5e4f13373ed6ad (patch) | |
tree | 96c27c5e9e956f030423bc67505d774761da1586 | |
parent | 1d223946bd0f71e9bf905d4e5fd034a8aab9d56f (diff) | |
download | assignment4-d5979ace2a56e6333d4c0e304c5e4f13373ed6ad.tar.gz |
run.sh: allow classpath override, answer only mode
-rwxr-xr-x | spellchecker/run.sh | 7 | ||||
-rw-r--r-- | spellchecker/src/SpellChecker.java | 11 |
2 files changed, 13 insertions, 5 deletions
diff --git a/spellchecker/run.sh b/spellchecker/run.sh index 14c7057..956ce67 100755 --- a/spellchecker/run.sh +++ b/spellchecker/run.sh @@ -1,4 +1,7 @@ #!/bin/sh -ant -q -S compile && +classpath="${CLASSPATH:+$CLASSPATH:}" +classpath+=build/classes + +ant -q -S compile >&2 && NO_PEACH=1 \ -java -ea -cp build/classes SpellChecker +java -ea -cp "$classpath" SpellChecker diff --git a/spellchecker/src/SpellChecker.java b/spellchecker/src/SpellChecker.java index 055326e..55f8f6b 100644 --- a/spellchecker/src/SpellChecker.java +++ b/spellchecker/src/SpellChecker.java @@ -33,10 +33,15 @@ public class SpellChecker { Scanner input = new Scanner(System.in); while (input.hasNextLine()) { String s0 = input.nextLine(); - System.out.println("Input : " + s0); String result = sc.correctPhrase(s0); - System.out.println("Answer: " + result); - System.out.println(); + + if (System.getenv("ANSWER_ONLY") == null) { + System.out.println("Input : " + s0); + System.out.println("Answer: " + result); + System.out.println(); + } else { + System.out.println(s0); + } } } |