mirror of
https://github.com/chenasraf/ctelnet_dart.git
synced 2026-05-17 17:48:07 +00:00
chore: cleanups
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -8,3 +8,6 @@ pubspec.lock
|
||||
|
||||
# secrets
|
||||
.env
|
||||
|
||||
# docs
|
||||
doc/
|
||||
|
||||
@@ -43,4 +43,3 @@ void main(List<String> args) async {
|
||||
|
||||
await client.disconnect();
|
||||
}
|
||||
|
||||
|
||||
@@ -221,4 +221,3 @@ enum ConnectionStatus {
|
||||
/// The client is not connected to the server.
|
||||
disconnected,
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import '../consts.dart' as consts;
|
||||
///
|
||||
/// Can be used to store the text and color information for a single token.
|
||||
///
|
||||
/// Use [formatted] to get the ANSI formatted text, usable in a terminal.
|
||||
/// Use [ColorToken.formatted] to get the ANSI formatted text, usable in a terminal.
|
||||
class ColorToken {
|
||||
/// The raw, uncoded text.
|
||||
String text;
|
||||
@@ -111,7 +111,7 @@ class ColorParser implements IReader {
|
||||
/// Each token represents a piece of text with color information. You can join all the text
|
||||
/// together (without separators) to get the original text, uncolored.
|
||||
///
|
||||
/// To get the colored text, use the [formatted] property of each token.
|
||||
/// To get the colored text, use the [ColorToken.formatted] property of each token.
|
||||
List<ColorToken> parse() {
|
||||
final lexed = <ColorToken>[];
|
||||
while (!reader.isDone) {
|
||||
@@ -262,4 +262,3 @@ class ColorParser implements IReader {
|
||||
@override
|
||||
setPosition(int position) => index = position;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,4 +7,3 @@ const colorPatternRaw = r'\[\d*m';
|
||||
const boldByte = 1;
|
||||
const italicByte = 3;
|
||||
const underlineByte = 4;
|
||||
|
||||
|
||||
@@ -15,7 +15,10 @@ void main() {
|
||||
final input = inputs[0];
|
||||
final output = ColorParser(input).parse();
|
||||
expect(output, [
|
||||
ColorToken(text: 'You are standing in a small clearing.', fgColor: 32, bgColor: 0),
|
||||
ColorToken(
|
||||
text: 'You are standing in a small clearing.',
|
||||
fgColor: 32,
|
||||
bgColor: 0),
|
||||
ColorToken.empty(),
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -79,4 +79,3 @@ void main() {
|
||||
expect(client.status, equals(ConnectionStatus.disconnected));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user