Skip to content

Commit

Permalink
Fixed issue #45 by using jansi
Browse files Browse the repository at this point in the history
  • Loading branch information
adoble committed Feb 11, 2024
1 parent 68e6f15 commit b3de026
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ and from version 4.0.0 this project adheres to [Semantic Versioning](https://sem
* Nothing added as yet

### Changed
* Updated to use Java 21
* Fixed [issue 45](https://github.com/adoble/adr-j/issues/45).
* Updated the installation instructions to show how JBang can be used to simpify installation. See [issue 44](https://github.com/adoble/adr-j/issues/44) (many thanks to [maxandersen](https://github.com/maxandersen) for showing how this can be done).
* Updated to use Java 21.

### Fixed
* Nothing fixed as yet
Expand Down
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ repositories {
dependencies {
//implementation 'info.picocli:picocli:4.6.1'
implementation 'info.picocli:picocli:4.7.5'

// Jansi used for handling ANSO escape codes - even on Windows
implementation 'org.fusesource.jansi:jansi:1.8'

// Use JUnit Jupiter API for testing.
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation(platform('org.junit:junit-bom:5.7.1'))
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/doble/adr/ADR.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import picocli.CommandLine.Help.TextTable;
import picocli.CommandLine.IHelpSectionRenderer;
import picocli.CommandLine.Model.UsageMessageSpec;
import org.fusesource.jansi.AnsiConsole;

/**
* Java version of the adr tool at https://github.com/npryce/adr-tools.
Expand All @@ -40,6 +41,8 @@ public class ADR {
public static void main(String[] args) {
int errorCode = 0;

AnsiConsole.systemInstall(); // Enable colors on Windows

// Determine the editor from the system environment
EditorCommandResolver editorCommandResolver = new EditorCommandResolver();
String editorCommand = editorCommandResolver.editorCommand();
Expand All @@ -61,6 +64,8 @@ public static void main(String[] args) {

errorCode = ADR.run(args, mainEnv);

AnsiConsole.systemUninstall(); // Cleanup when done

System.exit(errorCode);

}
Expand Down

0 comments on commit b3de026

Please sign in to comment.