当前位置: 首页>>代码示例>>Java>>正文


Java AnsiConsole.systemInstall方法代码示例

本文整理汇总了Java中org.fusesource.jansi.AnsiConsole.systemInstall方法的典型用法代码示例。如果您正苦于以下问题:Java AnsiConsole.systemInstall方法的具体用法?Java AnsiConsole.systemInstall怎么用?Java AnsiConsole.systemInstall使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.fusesource.jansi.AnsiConsole的用法示例。


在下文中一共展示了AnsiConsole.systemInstall方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.fusesource.jansi.AnsiConsole; //导入方法依赖的package包/类
public void main(String[] args) {

        //Activate ANSI on Windows
        AnsiConsole.systemInstall();
        System.setProperty("picocli.ansi", "true");

        //System Property gets set here, because picocli.trace must be set before CommandLine starts
        String input = String.join("", args);
        if (input.contains("-m")) {
            System.setProperty("picocli.trace", "DEBUG");
        } else if (input.contains("-v")) {
            System.setProperty("picocli.trace", "INFO");
        }

        CommandLine commandLine = new CommandLine(new CliMain(), new CliPropertiesFactory(apiController));
        commandLine.parseWithHandler(new CommandLine.RunLast(), System.err, args);
        AnsiConsole.systemUninstall();
    }
 
开发者ID:StuPro-TOSCAna,项目名称:TOSCAna,代码行数:19,代码来源:CliMain.java

示例2: initializeGame

import org.fusesource.jansi.AnsiConsole; //导入方法依赖的package包/类
private static void initializeGame() {

		AnsiConsole.systemInstall();
		
		try {
			GlobalScreen.registerNativeHook();
		} catch (NativeHookException ex) {
			System.err.println("There was a problem registering the native hook.");
			System.err.println(ex.getMessage());

			System.exit(1);
		}

		// registers a shutdown hook
		// this shutdown hook is called before the jvm is shutdown and releases the dependencies
		Runtime.getRuntime().addShutdownHook(new Thread() {
			@Override
			public void run() {
				GlobalScreen.unregisterNativeHook();
				System.out.println("unregister native hook");
				AnsiConsole.out.print(Ansi.ansi().eraseScreen(Erase.FORWARD));
				AnsiConsole.systemUninstall();
				System.out.println("uninstall ansi console");
				// network can be closed here
			}
		});
	}
 
开发者ID:manuelz120,项目名称:tetris4j,代码行数:28,代码来源:Main.java

示例3: main

import org.fusesource.jansi.AnsiConsole; //导入方法依赖的package包/类
public static void main(String[] args) {

        // On Windows without Cygwin or similar, picocli will not emit ANSI escape codes by default.
        // Force ANSI ON if no user preference, otherwise let user decide.
        Ansi ansi = System.getProperty("picocli.ansi") == null ? Ansi.ON : Ansi.AUTO;

        AnsiConsole.systemInstall(); // Jansi magic
        CommandLine.run(new WindowsJansiDemo(), System.err, ansi, args);
        AnsiConsole.systemUninstall();
    }
 
开发者ID:remkop,项目名称:picocli,代码行数:11,代码来源:WindowsJansiDemo.java

示例4: print

import org.fusesource.jansi.AnsiConsole; //导入方法依赖的package包/类
/**
 * Prints a Uniform Fuzzy Hash in a visual way.
 * 
 * @param hash The Uniform Fuzzy Hash.
 * @param base The characters base which will be used to represent the blocks.
 * @param factorDivisor Amount of characters per factor size for each block.
 * @param lineWrap Amount of characters per line. If this argument is lower than 1, no line wrap
 *        is performed and the full representation is printed in one line.
 * @param concatenatePercent In case line wrap is performed, true to concatenate to each line
 *        its relative percent to the total length.
 */
public static void print(
        UniformFuzzyHash hash,
        char[] base,
        int factorDivisor,
        int lineWrap,
        boolean concatenatePercent) {

    // Representation.
    String representation = represent(hash, base, factorDivisor);
    List<String> wrappedRepresentation =
            wrapString(representation, lineWrap, concatenatePercent);

    // Print.
    final PrintStream printStream = System.out;

    if (printStream == AnsiConsole.out) {
        AnsiConsole.systemInstall();
    }

    printStream.println();

    for (String line : wrappedRepresentation) {
        printStream.println(line);
    }

    printStream.println();

    if (printStream == AnsiConsole.out) {
        AnsiConsole.systemUninstall();
    }

}
 
开发者ID:s3curitybug,项目名称:similarity-uniform-fuzzy-hash,代码行数:44,代码来源:VisualRepresentation.java

示例5: main

import org.fusesource.jansi.AnsiConsole; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    AnsiConsole.systemInstall();

    Logger.init();

    logoStr = logoStr.replace("█", ansi().fg(Ansi.Color.GREEN).a("█").reset().toString());

    System.out.println(ansi().eraseScreen().render(logoStr));
    System.out.println(ANSI_PURPLE + "Welcome to JustEL Debug Tools~~" + ANSI_RESET);

    System.out.println(ansi().fgBrightGreen().render(help).reset().toString());
    if (args.length < 1) {
        System.out.println(ansi().fgBrightRed().render("need more args").reset().toString());
        return;
    }

    String type = args[0];
    resolveCommandFlag(type, true);

    run();

    // close executor
    executor.shutdown();
}
 
开发者ID:lfkdsk,项目名称:Just-Evaluator,代码行数:25,代码来源:JustRepl.java

示例6: start

import org.fusesource.jansi.AnsiConsole; //导入方法依赖的package包/类
public void start() throws LoginException, InterruptedException, RateLimitedException {
    running = true;

    // init logger
    AnsiConsole.systemInstall();
    log = Logger.getLogger("Kyoko");
    log.setUseParentHandlers(false);
    ColoredFormatter formatter = new ColoredFormatter();
    ConsoleHandler handler = new ConsoleHandler();
    handler.setFormatter(formatter);
    log.addHandler(handler);

    log.info("Kyoko v" + Constants.VERSION + " is starting...");

    i18n.loadMessages();

    JDABuilder builder = new JDABuilder(AccountType.BOT);
    if (settings.getToken() != null) {
        if (settings.getToken().equalsIgnoreCase("Change me")) {
            System.out.println("No token specified, please set it in config.json");
            System.exit(1);
        }
        builder.setToken(settings.getToken());
    }

    boolean gameEnabled = false;
    if (settings.getGame() != null && !settings.getGame().isEmpty()) {
        gameEnabled = true;
        builder.setGame(Game.of("booting..."));
    }

    builder.setAutoReconnect(true);
    builder.setBulkDeleteSplittingEnabled(false);
    builder.addEventListener(eventHandler);
    builder.setAudioEnabled(true);
    builder.setStatus(OnlineStatus.IDLE);
    jda = builder.buildBlocking();

    log.info("Invite link: " + "https://discordapp.com/oauth2/authorize?&client_id=" + jda.getSelfUser().getId() + "&scope=bot&permissions=" + Constants.PERMISSIONS);

    if (gameEnabled) {
        Thread t = new Thread(new Kyoko.BlinkThread());
        t.start();
    }

    registerCommands();
}
 
开发者ID:gabixdev,项目名称:Kyoko,代码行数:48,代码来源:Kyoko.java

示例7: MainLogger

import org.fusesource.jansi.AnsiConsole; //导入方法依赖的package包/类
public MainLogger(String logFile, Boolean logDebug) {
    AnsiConsole.systemInstall();

    if (logger != null) {
        throw new RuntimeException("MainLogger has been already created");
    }
    logger = this;
    this.logFile = new File(logFile);
    if (!this.logFile.exists()) {
        try {
            this.logFile.createNewFile();
        } catch (IOException e) {
            this.logException(e);
        }
    }
    this.logDebug = logDebug;
    this.start();
}
 
开发者ID:PrismarineMC,项目名称:Nemisys-0.12,代码行数:19,代码来源:MainLogger.java

示例8: main

import org.fusesource.jansi.AnsiConsole; //导入方法依赖的package包/类
public static void main(String[] args) {
    for (String arg : args) {
        switch (arg) {
            case "-disable-ansi":
                ANSI = false;
                break;
            case "-dev":
                DEV_MODE = true;
                break;
            default:
                System.out.println("WarpEngine: \"" + arg + "\" is not a WarpEngine start parameter.");
        }
    }

    if (ANSI) {
        //Enable ANSI
        AnsiConsole.systemInstall();
    }

    new WarpEngine();

}
 
开发者ID:Nukkit,项目名称:WarpEngine,代码行数:23,代码来源:WarpEngine.java

示例9: AldaRepl

import org.fusesource.jansi.AnsiConsole; //导入方法依赖的package包/类
public AldaRepl(AldaServer server, boolean verbose) {
  this.server = server;
  server.setQuiet(true);
  this.verbose = verbose;
  history = new StringBuffer();
  manager = new ReplCommandManager();
  try {
    r = new ConsoleReader();
 r.setHandleUserInterrupt(true);
  } catch (IOException e) {
    System.err.println("An error was detected when we tried to read a line.");
    e.printStackTrace();
    ExitCode.SYSTEM_ERROR.exit();
  }
  AnsiConsole.systemInstall();
}
 
开发者ID:alda-lang,项目名称:alda-client-java,代码行数:17,代码来源:AldaRepl.java

示例10: run

import org.fusesource.jansi.AnsiConsole; //导入方法依赖的package包/类
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();
   }
}
 
开发者ID:IG-Group,项目名称:ig-webapi-java-sample,代码行数:41,代码来源:Application.java

示例11: AnsiLogger

import org.fusesource.jansi.AnsiConsole; //导入方法依赖的package包/类
public AnsiLogger(final boolean debug, @Nonnull Format format,
                  @Nonnull PrintStream out, @Nonnull PrintStream err) {
    this.debug = debug;
    this.format = format;
    this.out = out;
    this.err = err;

    try {
        if (isOutputInteractive()) {
            Ansi.setEnabled(true);
            AnsiConsole.systemInstall();
        } else {
            Ansi.setEnabled(false);
        }
    } catch (Throwable t) {
        // Not running on a distro with standard c library, disable Ansi.
        Ansi.setEnabled(false);
    }
}
 
开发者ID:neo4j,项目名称:cypher-shell,代码行数:20,代码来源:AnsiLogger.java

示例12: detectAnsiSupport

import org.fusesource.jansi.AnsiConsole; //导入方法依赖的package包/类
private static boolean detectAnsiSupport() {
    AnsiConsole.systemInstall(); // CraftBukkit - install Windows JNI library
    OutputStream out = AnsiConsole.wrapOutputStream(new ByteArrayOutputStream());
    try {
        out.close();
    }
    catch (Exception e) {
        // ignore;
    }
    return out instanceof WindowsAnsiOutputStream;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:12,代码来源:AnsiWindowsTerminal.java

示例13: GroovyInterpreter

import org.fusesource.jansi.AnsiConsole; //导入方法依赖的package包/类
public GroovyInterpreter(Binding binding) throws IOException {
	this.binding = binding;
	if (this.binding == null)
		this.binding = new Binding();

	is = new PipedInputStream();
	os = new PipedOutputStream();
	pis = new PipedInputStream(os);
	pos = new PipedOutputStream(is);

	System.setProperty(TerminalFactory.JLINE_TERMINAL, "none");
	AnsiConsole.systemInstall();
	Ansi.setDetector(new AnsiDetector());

	binding.setProperty("out", new ImmediateFlushingPrintWriter(pos));

	shell = new Groovysh(binding, new IO(pis, pos, pos));
	// {
	// @Override
	// public void displayWelcomeBanner(InteractiveShellRunner runner) {
	// // do nothing
	// }
	// };
	shell.getIo().setVerbosity(Verbosity.QUIET);
}
 
开发者ID:jonhare,项目名称:COMP6237,代码行数:26,代码来源:GroovyInterpreter.java

示例14: JythonInterpreter

import org.fusesource.jansi.AnsiConsole; //导入方法依赖的package包/类
public JythonInterpreter() throws IOException {
	is = new PipedInputStream();
	os = new PipedOutputStream();
	pis = new PipedInputStream(os);
	pos = new PipedOutputStream(is);

	System.setProperty(TerminalFactory.JLINE_TERMINAL, "none");
	AnsiConsole.systemInstall();
	Ansi.setDetector(new AnsiDetector());

	shell = new InteractiveConsole();
	shell.setIn(pis);
	shell.setOut(pos);
	shell.setErr(pos);
}
 
开发者ID:jonhare,项目名称:COMP6237,代码行数:16,代码来源:JythonInterpreter.java

示例15: main

import org.fusesource.jansi.AnsiConsole; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception
{
    Log.setOutput( new PrintStream( ByteStreams.nullOutputStream() ) );
    AnsiConsole.systemInstall();
    consoleReader = new ConsoleReader();
    consoleReader.setExpandEvents( false );

    logger = new BungeeLogger();
    System.setErr( new PrintStream( new LoggingOutputStream( logger, Level.SEVERE ), true ) );
    System.setOut( new PrintStream( new LoggingOutputStream( logger, Level.INFO ), true ) );

    instance = new ChunkrServer();

    while ( isRunning )
    {
        String line = consoleReader.readLine( ">" );
        if ( line != null )
        {
            if ( !getInstance().getPluginManager().dispatchCommand( line ) )
            {
                logger.info( "Command not found" );
            }
        }
    }
}
 
开发者ID:Chnkr,项目名称:ChunkrConnect,代码行数:26,代码来源:ChunkrServer.java


注:本文中的org.fusesource.jansi.AnsiConsole.systemInstall方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。