@@ -0,0 +1,2062 @@
+// Copyright 2016 The Bazel Authors. All rights reserved.%0A//%0A// Licensed under the Apache License, Version 2.0 (the %22License%22);%0A// you may not use this file except in compliance with the License.%0A// You may obtain a copy of the License at%0A//%0A//    http://www.apache.org/licenses/LICENSE-2.0%0A//%0A// Unless required by applicable law or agreed to in writing, software%0A// distributed under the License is distributed on an %22AS IS%22 BASIS,%0A// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A// See the License for the specific language governing permissions and%0A// limitations under the License.%0Apackage com.google.devtools.build.lib.util.io;%0A%0Aimport java.io.IOException;%0A%0A/**%0A * An append-only interface to access to a terminal.%0A *%0A * This interface allows to specify a text to be written to the user%0A * using semantical highlighting (like failure) without any knowledge%0A * about the nature of the terminal or the position the text is to be%0A * written to. Callers to this interface should make no assumption%0A * about how the text is rendered; if the user's terminal does not%0A * support, e.g., colors, the highlighting might be done by adding%0A * additional characters.%0A *%0A * All interface functions are supposed to return the object itself%0A * to allow chaining of commands.%0A */%0Apublic interface AnsiTerminalWriter %7B%0A%0A  /**%0A   * Write some text to the user%0A   */%0A  AnsiTerminalWriter append(String text) throws IOException;%0A%0A  /**%0A   * Start a new line in the way appropriate for the given terminal%0A   */%0A  AnsiTerminalWriter newline() throws IOException;%0A%0A  /**%0A   * Tell the terminal that the following text will be a positive%0A   * status message.%0A   */%0A  AnsiTerminalWriter okStatus() throws IOException;%0A%0A  /**%0A   * Tell the terminal that the following text will be an error-reporting%0A   * status message.%0A   */%0A  AnsiTerminalWriter failStatus() throws IOException;%0A%0A  /**%0A   * Tell the terminal that the following text will be normal text, not%0A   * indicating a status or similar.%0A   */%0A  AnsiTerminalWriter normal() throws IOException;%0A%7D%0A

Add an interface for append-only access to an AnsiTerminal