add ansiSupported (#4)
* add ansiSupported
* review comments
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 104fc67..418f0a0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+### 1.1.0
+
+* Added `ansiSupported`
+* Bumped minimum Dart SDK version to 1.23.0-dev.9.0
+
#### 1.0.2
* Minor doc updates
diff --git a/lib/src/interface/local_platform.dart b/lib/src/interface/local_platform.dart
index a0406c3..178c683 100644
--- a/lib/src/interface/local_platform.dart
+++ b/lib/src/interface/local_platform.dart
@@ -46,4 +46,7 @@
@override
String get version => io.Platform.version;
+
+ @override
+ bool get ansiSupported => io.Platform.ansiSupported;
}
diff --git a/lib/src/interface/platform.dart b/lib/src/interface/platform.dart
index 35b111b..a603e3c 100644
--- a/lib/src/interface/platform.dart
+++ b/lib/src/interface/platform.dart
@@ -114,6 +114,12 @@
/// whitespace and other version and build details.
String get version;
+ /// When stdio is connected to a terminal, whether ANSI codes are supported.
+ ///
+ /// This value is hard-coded to true, except on Windows where only more recent
+ /// versions of Windows 10 support the codes.
+ bool get ansiSupported;
+
/// Returns a JSON-encoded representation of this platform.
String toJson() {
return const JsonEncoder.withIndent(' ').convert(<String, dynamic>{
@@ -129,6 +135,7 @@
'packageRoot': packageRoot,
'packageConfig': packageConfig,
'version': version,
+ 'ansiSupported': ansiSupported,
});
}
}
diff --git a/lib/src/testing/fake_platform.dart b/lib/src/testing/fake_platform.dart
index 6256d14..04df6fe 100644
--- a/lib/src/testing/fake_platform.dart
+++ b/lib/src/testing/fake_platform.dart
@@ -25,6 +25,7 @@
this.packageRoot,
this.packageConfig,
this.version,
+ this.ansiSupported,
});
/// Creates a new [FakePlatform] with properties whose initial values mirror
@@ -41,7 +42,8 @@
executableArguments = new List<String>.from(platform.executableArguments),
packageRoot = platform.packageRoot,
packageConfig = platform.packageConfig,
- version = platform.version;
+ version = platform.version,
+ ansiSupported = platform.ansiSupported;
/// Creates a new [FakePlatform] with properties extracted from the encoded
/// JSON string.
@@ -63,6 +65,7 @@
packageRoot : map['packageRoot'],
packageConfig : map['packageConfig'],
version : map['version'],
+ ansiSupported: map['ansiSupported'],
);
}
@@ -101,4 +104,7 @@
@override
String version;
+
+ @override
+ bool ansiSupported;
}
diff --git a/pubspec.yaml b/pubspec.yaml
index a5e3575..af6d799 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: platform
-version: 1.0.2
+version: 1.1.0
authors:
- Todd Volkert <tvolkert@google.com>
description: A pluggable, mockable platform abstraction for Dart.
@@ -9,4 +9,4 @@
test: ^0.12.10
environment:
- sdk: '>=1.19.0 <2.0.0'
+ sdk: '>=1.23.0-dev.9.0 <2.0.0'