Skip to content

Commit

Permalink
Add the README's example as a separate project
Browse files Browse the repository at this point in the history
This provides a minimal test executable for quickly trying out JAnsi. Run
it like

$ mvn --projects example exec:java
  • Loading branch information
sschuberth committed Jun 15, 2016
1 parent 25ed28f commit e180ab1
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
43 changes: 43 additions & 0 deletions example/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>jansi-project</artifactId>
<groupId>org.fusesource.jansi</groupId>
<version>1.13-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>example</artifactId>

<dependencies>
<dependency>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<version>${project.parent.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<mainClass>org.fusesource.jansi.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>

</project>
12 changes: 12 additions & 0 deletions example/src/main/java/org/fusesource/jansi/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.fusesource.jansi;

import static org.fusesource.jansi.Ansi.*;
import static org.fusesource.jansi.Ansi.Color.*;

public class Main {
public static void main(String[] args) {
AnsiConsole.systemInstall();
System.out.println( ansi().eraseScreen().fg(RED).a("Hello").fg(GREEN).a(" World").reset() );
AnsiConsole.systemUninstall();
}
}
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@

<modules>
<module>jansi</module>
<module>example</module>
<!--
<module>jansi-website</module>
-->
Expand Down

0 comments on commit e180ab1

Please sign in to comment.