org.springframework.boot.ansi.AnsiColor Java Examples

The following examples show how to use org.springframework.boot.ansi.AnsiColor. 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: Banner.java    From tomato with Apache License 2.0 6 votes vote down vote up
private static void printVersion() {
    System.out.println();
    PrintStream printStream = System.out;
    String version = Banner.getVersion();
    version = version != null ? " (v" + version + ")" : "";
    StringBuilder padding = new StringBuilder();

    while(padding.length() < 42 - (version.length() + name.length())) {
        padding.append(" ");
    }

    printStream.println(AnsiOutput.toString(new Object[]{AnsiColor.BRIGHT_RED, defaultBanner, AnsiColor.DEFAULT, padding.toString(), AnsiStyle.FAINT}));
    printStream.println();
    printStream.println(AnsiOutput.toString(new Object[]{AnsiColor.GREEN, " :: Tomato :: ", AnsiColor.DEFAULT, padding.toString(), AnsiStyle.FAINT, version}));
    printStream.println();
}
 
Example #2
Source File: SpringBootBanner.java    From oneplatform with Apache License 2.0 6 votes vote down vote up
@Override
public void printBanner(Environment environment, Class<?> sourceClass,
		PrintStream printStream) {
	for (String line : BANNER) {
		printStream.println(line);
	}
	String version = SpringBootVersion.getVersion();
	version = (version == null ? "" : " (v" + version + ")");
	String padding = "";
	while (padding.length() < STRAP_LINE_SIZE
			- (version.length() + SPRING_BOOT.length())) {
		padding += " ";
	}

	printStream.println(AnsiOutput.toString(AnsiColor.GREEN, SPRING_BOOT,
			AnsiColor.DEFAULT, padding, AnsiStyle.FAINT, version));
	printStream.println();
}
 
Example #3
Source File: TxLcnManagerBanner.java    From tx-lcn with Apache License 2.0 6 votes vote down vote up
@Override
public void printBanner(Environment environment, Class<?> sourceClass, PrintStream printStream) {
    String serverPortProperty = environment.getProperty("server.port");
    String managerPortProperty = environment.getProperty("tx-lcn.manager.port");
    int managerPort;
    int httpPort = 8080;
    if (serverPortProperty != null) {
        httpPort = Integer.parseInt(serverPortProperty);
    }
    if (managerPortProperty != null) {
        managerPort = Integer.parseInt(managerPortProperty);
    } else {
        managerPort = httpPort + TxManagerConfig.PORT_CHANGE_VALUE;
    }
    String string = String.format(SERVER_INFO, VERSION, httpPort, managerPort);
    printStream.println();
    printStream.println(AnsiOutput.toString(AnsiColor.GREEN, BANNER));
    printStream.println();
    printStream.println(AnsiOutput.toString(AnsiColor.GREEN, string));
    printStream.println();
}
 
Example #4
Source File: ProjectBanner.java    From sqlhelper with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void printBanner(Environment environment, Class<?> sourceClass, PrintStream out) {
    // banner
    out.println();
    if (Emptys.isNotEmpty(BANNER)) {
        for (String line : BANNER) {
            out.println(AnsiOutput.toString(AnsiColor.YELLOW, line));
        }
    } else {
        out.println(AnsiOutput.toString(AnsiColor.YELLOW, defaultValue));
    }

    Manifest manifest = Manifests.loadManifest();
    if (manifest != null) {
        Attributes attributes = manifest.getMainAttributes();
        String majorVersion = attributes.getValue("Build-Major-Version");
        String scmVersion = attributes.getValue("Build-SCM-Version");
        String fixedScmVersion = attributes.getValue("Build-FIXED-SCM-Version");
        if (Strings.isNotBlank(fixedScmVersion) && !fixedScmVersion.contains("fixed_version")) {
            scmVersion = fixedScmVersion;
        }
        String buildTime = attributes.getValue("Build-Timestamp");
        out.println(AnsiOutput.toString(AnsiColor.RED, StringTemplates.formatWithPlaceholder("Version: {} ({})", majorVersion, scmVersion)));
        out.println(AnsiOutput.toString(AnsiColor.RED, StringTemplates.formatWithPlaceholder("Build Time: {}", buildTime)));
    }

}
 
Example #5
Source File: InceptionBanner.java    From inception with Apache License 2.0 5 votes vote down vote up
@Override
public void printBanner(Environment environment, Class<?> sourceClass,
        PrintStream printStream) {
    for (String line : BANNER) {
        printStream.println(line);
    }
    String version = SettingsUtil.getVersionString();
    printStream.println(AnsiOutput.toString(AnsiColor.GREEN, AnsiStyle.FAINT, version));
    printStream.println();
}
 
Example #6
Source File: StartedListener.java    From halo with GNU General Public License v3.0 5 votes vote down vote up
private void printStartInfo() {
    String blogUrl = optionService.getBlogBaseUrl();
    log.info(AnsiOutput.toString(AnsiColor.BRIGHT_BLUE, "Halo started at         ", blogUrl));
    log.info(AnsiOutput.toString(AnsiColor.BRIGHT_BLUE, "Halo admin started at   ", blogUrl, "/", haloProperties.getAdminPath()));
    if (!haloProperties.isDocDisabled()) {
        log.debug(AnsiOutput.toString(AnsiColor.BRIGHT_BLUE, "Halo api doc was enabled at  ", blogUrl, "/swagger-ui.html"));
    }
    log.info(AnsiOutput.toString(AnsiColor.BRIGHT_YELLOW, "Halo has started successfully!"));
}
 
Example #7
Source File: WebAnnoBanner.java    From webanno with Apache License 2.0 5 votes vote down vote up
@Override
public void printBanner(Environment environment, Class<?> sourceClass,
        PrintStream printStream) {
    for (String line : BANNER) {
        printStream.println(line);
    }
    String version = SettingsUtil.getVersionString();
    printStream.println(AnsiOutput.toString(AnsiColor.GREEN, AnsiStyle.FAINT, version));
    printStream.println();
}
 
Example #8
Source File: ShellBannerProvider.java    From hdfs-shell with Apache License 2.0 4 votes vote down vote up
public String getWelcomeMessage() {
	return AnsiOutput.toString(AnsiColor.BRIGHT_GREEN, "Welcome to HDFS-shell CLI ", AnsiColor.DEFAULT);
}