Skip to content

Commit

Permalink
Change package name to avoid confusion between Jansi 2.x and JLine-Jansi
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Oct 12, 2023
1 parent a87af27 commit e6cab2a
Show file tree
Hide file tree
Showing 18 changed files with 86 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
package org.fusesource.jansi;
package org.jline.jansi;

import java.util.ArrayList;
import java.util.concurrent.Callable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
package org.fusesource.jansi;
package org.jline.jansi;

/**
* Colors support.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
package org.fusesource.jansi;
package org.jline.jansi;

import java.io.FileDescriptor;
import java.io.FileOutputStream;
Expand All @@ -16,9 +16,9 @@
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;

import org.fusesource.jansi.io.AnsiOutputStream;
import org.fusesource.jansi.io.AnsiProcessor;
import org.fusesource.jansi.io.FastBufferedOutputStream;
import org.jline.jansi.io.AnsiOutputStream;
import org.jline.jansi.io.AnsiProcessor;
import org.jline.jansi.io.FastBufferedOutputStream;
import org.jline.terminal.Terminal;
import org.jline.terminal.TerminalBuilder;
import org.jline.terminal.impl.DumbTerminal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
package org.fusesource.jansi;
package org.jline.jansi;

import java.io.BufferedReader;
import java.io.Closeable;
Expand All @@ -18,11 +18,10 @@
import java.io.PrintStream;
import java.util.Properties;

import org.fusesource.jansi.Ansi.Attribute;
import org.jline.terminal.impl.Diag;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.fusesource.jansi.Ansi.ansi;
import static org.jline.jansi.Ansi.ansi;

/**
* Main class for the library, providing executable jar to diagnose Jansi setup.
Expand Down Expand Up @@ -165,21 +164,21 @@ public static void main(String... args) throws IOException {
if (f.exists()) {
// write file content
System.out.println(
ansi().bold().a("\"" + args[0] + "\" content:").reset());
Ansi.ansi().bold().a("\"" + args[0] + "\" content:").reset());
writeFileContent(f);
return;
}
}

// write args without Jansi then with Jansi AnsiConsole
System.out.println(ansi().bold().a("original args:").reset());
System.out.println(Ansi.ansi().bold().a("original args:").reset());
int i = 1;
for (String arg : args) {
AnsiConsole.sysOut().print(i++ + ": ");
AnsiConsole.sysOut().println(arg);
}

System.out.println(ansi().bold().a("Jansi filtered args:").reset());
System.out.println(Ansi.ansi().bold().a("Jansi filtered args:").reset());
i = 1;
for (String arg : args) {
System.out.print(i++ + ": ");
Expand Down Expand Up @@ -231,30 +230,32 @@ private static void testAnsi(boolean stderr) {
PrintStream s = stderr ? System.err : System.out;
s.print("test on System." + (stderr ? "err" : "out") + ":");
for (Ansi.Color c : Ansi.Color.values()) {
s.print(" " + ansi().fg(c) + c + ansi().reset());
s.print(" " + Ansi.ansi().fg(c) + c + Ansi.ansi().reset());
}
s.println();
s.print(" bright:");
for (Ansi.Color c : Ansi.Color.values()) {
s.print(" " + ansi().fgBright(c) + c + ansi().reset());
s.print(" " + Ansi.ansi().fgBright(c) + c + Ansi.ansi().reset());
}
s.println();
s.print(" bold:");
for (Ansi.Color c : Ansi.Color.values()) {
s.print(" " + ansi().bold().fg(c) + c + ansi().reset());
s.print(" " + Ansi.ansi().bold().fg(c) + c + Ansi.ansi().reset());
}
s.println();
s.print(" faint:");
for (Ansi.Color c : Ansi.Color.values()) {
s.print(" " + ansi().a(Attribute.INTENSITY_FAINT).fg(c) + c + ansi().reset());
s.print(" " + Ansi.ansi().a(Ansi.Attribute.INTENSITY_FAINT).fg(c) + c
+ Ansi.ansi().reset());
}
s.println();
s.print(" bold+faint:");
for (Ansi.Color c : Ansi.Color.values()) {
s.print(" " + ansi().bold().a(Attribute.INTENSITY_FAINT).fg(c) + c + ansi().reset());
s.print(" " + Ansi.ansi().bold().a(Ansi.Attribute.INTENSITY_FAINT).fg(c) + c
+ Ansi.ansi().reset());
}
s.println();
Ansi ansi = ansi();
Ansi ansi = Ansi.ansi();
ansi.a(" 256 colors: ");
for (int i = 0; i < 6 * 6 * 6; i++) {
if (i > 0 && i % 36 == 0) {
Expand All @@ -272,7 +273,7 @@ private static void testAnsi(boolean stderr) {
}
ansi.reset();
s.println(ansi);
ansi = ansi();
ansi = Ansi.ansi();
ansi.a(" truecolor: ");
for (int i = 0; i < 256; i++) {
if (i > 0 && i % 48 == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
package org.fusesource.jansi;
package org.jline.jansi;

/**
* Ansi mode.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
package org.fusesource.jansi;
package org.jline.jansi;

import java.io.IOException;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;

import org.fusesource.jansi.io.AnsiOutputStream;
import org.jline.jansi.io.AnsiOutputStream;

/**
* Simple PrintStream holding an AnsiOutputStream.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
package org.fusesource.jansi;
package org.jline.jansi;

import java.io.IOException;
import java.util.Locale;

import org.fusesource.jansi.Ansi.Attribute;
import org.fusesource.jansi.Ansi.Color;

/**
* Renders ANSI color escape-codes in strings by parsing out some special syntax to pick up the correct fluff to use.
*
Expand Down Expand Up @@ -161,57 +158,57 @@ public enum Code {
//

// Colors
BLACK(Color.BLACK),
RED(Color.RED),
GREEN(Color.GREEN),
YELLOW(Color.YELLOW),
BLUE(Color.BLUE),
MAGENTA(Color.MAGENTA),
CYAN(Color.CYAN),
WHITE(Color.WHITE),
DEFAULT(Color.DEFAULT),
BLACK(Ansi.Color.BLACK),
RED(Ansi.Color.RED),
GREEN(Ansi.Color.GREEN),
YELLOW(Ansi.Color.YELLOW),
BLUE(Ansi.Color.BLUE),
MAGENTA(Ansi.Color.MAGENTA),
CYAN(Ansi.Color.CYAN),
WHITE(Ansi.Color.WHITE),
DEFAULT(Ansi.Color.DEFAULT),

// Foreground Colors
FG_BLACK(Color.BLACK, false),
FG_RED(Color.RED, false),
FG_GREEN(Color.GREEN, false),
FG_YELLOW(Color.YELLOW, false),
FG_BLUE(Color.BLUE, false),
FG_MAGENTA(Color.MAGENTA, false),
FG_CYAN(Color.CYAN, false),
FG_WHITE(Color.WHITE, false),
FG_DEFAULT(Color.DEFAULT, false),
FG_BLACK(Ansi.Color.BLACK, false),
FG_RED(Ansi.Color.RED, false),
FG_GREEN(Ansi.Color.GREEN, false),
FG_YELLOW(Ansi.Color.YELLOW, false),
FG_BLUE(Ansi.Color.BLUE, false),
FG_MAGENTA(Ansi.Color.MAGENTA, false),
FG_CYAN(Ansi.Color.CYAN, false),
FG_WHITE(Ansi.Color.WHITE, false),
FG_DEFAULT(Ansi.Color.DEFAULT, false),

// Background Colors
BG_BLACK(Color.BLACK, true),
BG_RED(Color.RED, true),
BG_GREEN(Color.GREEN, true),
BG_YELLOW(Color.YELLOW, true),
BG_BLUE(Color.BLUE, true),
BG_MAGENTA(Color.MAGENTA, true),
BG_CYAN(Color.CYAN, true),
BG_WHITE(Color.WHITE, true),
BG_DEFAULT(Color.DEFAULT, true),
BG_BLACK(Ansi.Color.BLACK, true),
BG_RED(Ansi.Color.RED, true),
BG_GREEN(Ansi.Color.GREEN, true),
BG_YELLOW(Ansi.Color.YELLOW, true),
BG_BLUE(Ansi.Color.BLUE, true),
BG_MAGENTA(Ansi.Color.MAGENTA, true),
BG_CYAN(Ansi.Color.CYAN, true),
BG_WHITE(Ansi.Color.WHITE, true),
BG_DEFAULT(Ansi.Color.DEFAULT, true),

// Attributes
RESET(Attribute.RESET),
INTENSITY_BOLD(Attribute.INTENSITY_BOLD),
INTENSITY_FAINT(Attribute.INTENSITY_FAINT),
ITALIC(Attribute.ITALIC),
UNDERLINE(Attribute.UNDERLINE),
BLINK_SLOW(Attribute.BLINK_SLOW),
BLINK_FAST(Attribute.BLINK_FAST),
BLINK_OFF(Attribute.BLINK_OFF),
NEGATIVE_ON(Attribute.NEGATIVE_ON),
NEGATIVE_OFF(Attribute.NEGATIVE_OFF),
CONCEAL_ON(Attribute.CONCEAL_ON),
CONCEAL_OFF(Attribute.CONCEAL_OFF),
UNDERLINE_DOUBLE(Attribute.UNDERLINE_DOUBLE),
UNDERLINE_OFF(Attribute.UNDERLINE_OFF),
RESET(Ansi.Attribute.RESET),
INTENSITY_BOLD(Ansi.Attribute.INTENSITY_BOLD),
INTENSITY_FAINT(Ansi.Attribute.INTENSITY_FAINT),
ITALIC(Ansi.Attribute.ITALIC),
UNDERLINE(Ansi.Attribute.UNDERLINE),
BLINK_SLOW(Ansi.Attribute.BLINK_SLOW),
BLINK_FAST(Ansi.Attribute.BLINK_FAST),
BLINK_OFF(Ansi.Attribute.BLINK_OFF),
NEGATIVE_ON(Ansi.Attribute.NEGATIVE_ON),
NEGATIVE_OFF(Ansi.Attribute.NEGATIVE_OFF),
CONCEAL_ON(Ansi.Attribute.CONCEAL_ON),
CONCEAL_OFF(Ansi.Attribute.CONCEAL_OFF),
UNDERLINE_DOUBLE(Ansi.Attribute.UNDERLINE_DOUBLE),
UNDERLINE_OFF(Ansi.Attribute.UNDERLINE_OFF),

// Aliases
BOLD(Attribute.INTENSITY_BOLD),
FAINT(Attribute.INTENSITY_FAINT);
BOLD(Ansi.Attribute.INTENSITY_BOLD),
FAINT(Ansi.Attribute.INTENSITY_FAINT);

private final Enum<?> n;

Expand All @@ -227,19 +224,19 @@ public enum Code {
}

public boolean isColor() {
return n instanceof Color;
return n instanceof Ansi.Color;
}

public Color getColor() {
return (Color) n;
public Ansi.Color getColor() {
return (Ansi.Color) n;
}

public boolean isAttribute() {
return n instanceof Attribute;
return n instanceof Ansi.Attribute;
}

public Attribute getAttribute() {
return (Attribute) n;
public Ansi.Attribute getAttribute() {
return (Ansi.Attribute) n;
}

public boolean isBackground() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
package org.fusesource.jansi;
package org.jline.jansi;

/**
* Processor type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
package org.fusesource.jansi;
package org.jline.jansi;

@Deprecated
public class WindowsSupport {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
package org.fusesource.jansi.io;
package org.jline.jansi.io;

import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.util.ArrayList;

import org.fusesource.jansi.AnsiColors;
import org.fusesource.jansi.AnsiMode;
import org.fusesource.jansi.AnsiType;
import org.jline.jansi.AnsiColors;
import org.jline.jansi.AnsiMode;
import org.jline.jansi.AnsiType;

import static java.nio.charset.StandardCharsets.US_ASCII;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
package org.fusesource.jansi.io;
package org.jline.jansi.io;

import java.io.IOException;
import java.io.OutputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
package org.fusesource.jansi.io;
package org.jline.jansi.io;

/**
* Helper class for dealing with color rounding.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
package org.fusesource.jansi.io;
package org.jline.jansi.io;

import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Iterator;

import org.fusesource.jansi.AnsiColors;
import org.jline.jansi.AnsiColors;

/**
* Ansi processor to process color conversion if needed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
package org.fusesource.jansi.io;
package org.jline.jansi.io;

import java.io.FilterOutputStream;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
package org.fusesource.jansi.io;
package org.jline.jansi.io;

import java.io.IOException;
import java.io.OutputStream;
Expand Down
Loading

0 comments on commit e6cab2a

Please sign in to comment.