[TOREE-483] Add %showOutput magic to disable console output

Closes #161
diff --git a/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelOptions.scala b/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelOptions.scala
index 625c14e..194fd5e 100644
--- a/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelOptions.scala
+++ b/kernel-api/src/main/scala/org/apache/toree/kernel/api/KernelOptions.scala
@@ -20,4 +20,5 @@
 object KernelOptions {
   var showTypes: Boolean = false
   var noTruncation: Boolean = false
+  var showOutput: Boolean = true
 }
diff --git a/kernel/src/main/scala/org/apache/toree/magic/builtin/ShowOutput.scala b/kernel/src/main/scala/org/apache/toree/magic/builtin/ShowOutput.scala
new file mode 100644
index 0000000..8458eb7
--- /dev/null
+++ b/kernel/src/main/scala/org/apache/toree/magic/builtin/ShowOutput.scala
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+package org.apache.toree.magic.builtin
+import java.io.PrintStream
+import org.apache.toree.kernel.api.KernelOptions
+import org.apache.toree.magic.LineMagic
+import org.apache.toree.magic.dependencies.IncludeOutputStream
+import org.apache.toree.plugins.annotations.Event
+class ShowOutput extends LineMagic with IncludeOutputStream {
+  private def printStream = new PrintStream(outputStream)
+  @Event(name = "showoutput")
+  override def execute(code: String): Unit = {
+    code match {
+      case "on" =>
+        printStream.println(s"Console output WILL be shown.")
+        KernelOptions.showOutput = true
+      case "off" =>
+        printStream.println(s"Console output will NOT be shown.")
+        KernelOptions.showOutput = false
+      case "" =>
+        printStream.println(s"Console output display is currently ${if (KernelOptions.showOutput) "on" else "off"}.")
+      case other =>
+        printStream.println(s"${other} is not a valid option for the ShowOutput magic.")
+    }
+  }
+}
\ No newline at end of file
diff --git a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
index 66f4d66..86bcc62 100644
--- a/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
+++ b/scala-interpreter/src/main/scala/org/apache/toree/kernel/interpreter/scala/ScalaInterpreter.scala
@@ -190,6 +190,7 @@
    }
 
   def prepareResult(interpreterOutput: String,
+                    showOutput: Boolean = true,
                     showType: Boolean = false,
                     noTruncate: Boolean = false
                    ): (Option[AnyRef], Option[String], Option[String]) = {
@@ -257,8 +258,8 @@
     }
 
     (lastResult,
-     if (definitions.nonEmpty) Some(definitions.toString) else None,
-     if (text.nonEmpty) Some(text.toString) else None)
+     if (definitions.nonEmpty && showOutput) Some(definitions.toString) else None,
+     if (text.nonEmpty && showOutput) Some(text.toString) else None)
   }
 
   protected def interpretBlock(code: String, silent: Boolean = false):
@@ -299,7 +300,7 @@
          val lastOutput = lastResultOut.toString("UTF-8").trim
          lastResultOut.reset()
 
-         val (obj, defStr, text) = prepareResult(lastOutput, KernelOptions.showTypes, KernelOptions.noTruncation )
+         val (obj, defStr, text) = prepareResult(lastOutput, KernelOptions.showOutput, KernelOptions.showTypes, KernelOptions.noTruncation )
          defStr.foreach(kernel.display.content(MIMEType.PlainText, _))
          text.foreach(kernel.display.content(MIMEType.PlainText, _))
          val output = obj.map(Displayers.display(_).asScala.toMap).getOrElse(Map.empty)