|
| 1 | +/* |
| 2 | + * Copyright (C) 2009-2020 the original author(s). |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package org.fusesource.jansi; |
| 17 | + |
| 18 | +import java.io.PrintStream; |
| 19 | + |
| 20 | +public class InstallUninstallTest { |
| 21 | + |
| 22 | + public static void main(String[] args) { |
| 23 | + print(System.out, "Lorem ipsum"); |
| 24 | + print(System.err, "dolor sit amet"); |
| 25 | + AnsiConsole.systemInstall(); |
| 26 | + print(System.out, "consectetur adipiscing elit"); |
| 27 | + print(System.err, "sed do eiusmod"); |
| 28 | + AnsiConsole.out().setAnsiMode(AnsiMode.Strip); |
| 29 | + AnsiConsole.err().setAnsiMode(AnsiMode.Strip); |
| 30 | + print(System.out, "tempor incididunt ut"); |
| 31 | + print(System.err, "labore et dolore"); |
| 32 | + AnsiConsole.systemUninstall(); |
| 33 | + print(System.out, "magna aliqua."); |
| 34 | + print(System.err, "Ut enim ad "); |
| 35 | + } |
| 36 | + private static void print(PrintStream stream, String text) { |
| 37 | + int half = text.length() / 2; |
| 38 | + stream.print(text.substring(0, half)); |
| 39 | + stream.println(Ansi.ansi().fg(Ansi.Color.GREEN).a(text.substring(half)).reset()); |
| 40 | + } |
| 41 | +} |
0 commit comments