Java Code Examples for org.fusesource.jansi.AnsiConsole#systemUninstall()
The following examples show how to use
org.fusesource.jansi.AnsiConsole#systemUninstall() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HelpAnsiTest.java From picocli with Apache License 2.0 | 6 votes |
@Test public void testAnsiAutoJansiConsoleInstalledOverridesHintDisabled() { environmentVariables.clear(ANSI_ENVIRONMENT_VARIABLES); environmentVariables.set("CLICOLOR", "0"); // hint disabled System.setProperty("os.name", "Windows"); assertTrue(Ansi.isWindows()); assertFalse(Ansi.isPseudoTTY()); assertFalse(Ansi.forceDisabled()); assertFalse(Ansi.forceEnabled()); assertTrue(Ansi.hintDisabled()); assertFalse(Ansi.hintEnabled()); assertFalse(Ansi.isJansiConsoleInstalled()); AnsiConsole.systemInstall(); try { assertTrue(Ansi.isJansiConsoleInstalled()); assertTrue(Ansi.AUTO.enabled()); } finally { AnsiConsole.systemUninstall(); } }
Example 2
Source File: WindowsJansiDemo.java From picocli with Apache License 2.0 | 5 votes |
public static void main(String[] args) { // Since https://github.com/remkop/picocli/issues/491 was fixed in picocli 3.6.0, // Ansi.AUTO is automatically enabled if the AnsiConsole is installed. AnsiConsole.systemInstall(); // Jansi magic new CommandLine(new WindowsJansiDemo()).execute(args); AnsiConsole.systemUninstall(); }
Example 3
Source File: HelpAnsiTest.java From picocli with Apache License 2.0 | 5 votes |
@Test public void testAnsiEnabled() { assertTrue(Ansi.ON.enabled()); assertFalse(Ansi.OFF.enabled()); System.setProperty("picocli.ansi", "tty"); boolean hasConsole = Ansi.calcTTY() || Ansi.isPseudoTTY(); assertEquals(hasConsole, Ansi.AUTO.enabled()); System.setProperty("picocli.ansi", "true"); assertEquals(true, Ansi.AUTO.enabled()); System.setProperty("picocli.ansi", "false"); assertEquals(false, Ansi.AUTO.enabled()); System.clearProperty("picocli.ansi"); boolean isWindows = System.getProperty("os.name").startsWith("Windows"); boolean isXterm = System.getenv("TERM") != null && System.getenv("TERM").startsWith("xterm"); boolean hasOsType = System.getenv("OSTYPE") != null; // null on Windows unless on Cygwin or MSYS boolean isAtty = (isWindows && (isXterm || hasOsType)) // cygwin pseudo-tty || hasConsole(); assertEquals((isAtty && (!isWindows || isXterm || hasOsType)) || isJansiConsoleInstalled(), Ansi.AUTO.enabled()); if (isWindows && !Ansi.AUTO.enabled()) { AnsiConsole.systemInstall(); try { assertTrue(Ansi.AUTO.enabled()); } finally { AnsiConsole.systemUninstall(); } } }
Example 4
Source File: Application.java From ig-webapi-java-sample with BSD 3-Clause "New" or "Revised" License | 5 votes |
private boolean run(final String user, final String password, final String apiKey, final String epic) { InputStreamReader reader = new InputStreamReader(System.in); try(BufferedReader in = new BufferedReader(reader)) { AnsiConsole.systemInstall(); System.out.println(ansi().eraseScreen()); connect(user, password, apiKey); if(StringUtils.isNotBlank(epic)) { tradeableEpic = getTradeableEpic(epic); } else { tradeableEpic = getTradableEpicFromWatchlist(); } subscribeToLighstreamerAccountUpdates(); subscribeToLighstreamerHeartbeat(); subscribeToLighstreamerPriceUpdates(); subscribeToLighstreamerTradeUpdates(); logStatusMessage("Press ENTER to BUY"); ConversationContextV3 contextV3 = (ConversationContextV3) authenticationContext.getConversationContext(); while(true) { if(new Date().getTime() + 5000 > contextV3.getAccessTokenExpiry()) { // Refresh the access token 5 seconds before expiry logStatusMessage("Refreshing access token"); contextV3 = refreshAccessToken(contextV3); } Thread.sleep(20); if (in.ready()) { in.readLine(); createPosition(); } } } catch (Exception e) { logStatusMessage("Failure: " + e.getMessage()); return false; } finally { disconnect(); AnsiConsole.systemUninstall(); } }
Example 5
Source File: Logger.java From rscplus with GNU General Public License v3.0 | 5 votes |
public static void stop() { try { m_logWriter.close(); } catch (Exception e) { } AnsiConsole.systemUninstall(); }
Example 6
Source File: GruntParser.java From spork with Apache License 2.0 | 5 votes |
@Override protected void printClear() { AnsiConsole.systemInstall(); Ansi ansi = Ansi.ansi(); System.out.println( ansi.eraseScreen() ); System.out.println( ansi.cursor(0, 0) ); AnsiConsole.systemUninstall(); }
Example 7
Source File: AnsiLoggerTest.java From jkube with Eclipse Public License 2.0 | 4 votes |
@AfterClass public static void restoreAnsiPassthrough() { AnsiConsole.systemUninstall(); System.setOut(AnsiConsole.out); System.setErr(AnsiConsole.err); }
Example 8
Source File: AnsiLoggerTest.java From docker-maven-plugin with Apache License 2.0 | 4 votes |
@AfterClass public static void restoreAnsiPassthrough() { AnsiConsole.systemUninstall(); System.setOut(AnsiConsole.out); System.setErr(AnsiConsole.err); }
Example 9
Source File: AbstractConsole.java From elasticshell with Apache License 2.0 | 4 votes |
@Override public void shutdown() { AnsiConsole.systemUninstall(); }