Added stdinSupportsAnsi and stdinSupportsAnsi (#9)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8ec72a7..25d0ae2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+### 2.0.0
+* Added `stdinSupportsAnsi` and `stdinSupportsAnsi`
+* Removed `ansiSupported`
+
### 1.1.1
* Updated `LocalPlatform` to use new `dart.io` API for ansi color support queries
diff --git a/lib/src/interface/local_platform.dart b/lib/src/interface/local_platform.dart
index e9e7bfb..c90256a 100644
--- a/lib/src/interface/local_platform.dart
+++ b/lib/src/interface/local_platform.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'dart:io' as io show Platform, stdin;
+import 'dart:io' as io show Platform, stdin, stdout;
import 'platform.dart';
@@ -48,5 +48,8 @@
String get version => io.Platform.version;
@override
- bool get ansiSupported => io.stdin.supportsAnsiEscapes;
+ bool get stdinSupportsAnsi => io.stdin.supportsAnsiEscapes;
+
+ @override
+ bool get stdoutSupportsAnsi => io.stdout.supportsAnsiEscapes;
}
diff --git a/lib/src/interface/platform.dart b/lib/src/interface/platform.dart
index a603e3c..c750108 100644
--- a/lib/src/interface/platform.dart
+++ b/lib/src/interface/platform.dart
@@ -114,11 +114,11 @@
/// 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;
+ /// When stdin is connected to a terminal, whether ANSI codes are supported.
+ bool get stdinSupportsAnsi;
+
+ /// When stdout is connected to a terminal, whether ANSI codes are supported.
+ bool get stdoutSupportsAnsi;
/// Returns a JSON-encoded representation of this platform.
String toJson() {
@@ -135,7 +135,8 @@
'packageRoot': packageRoot,
'packageConfig': packageConfig,
'version': version,
- 'ansiSupported': ansiSupported,
+ 'stdinSupportsAnsi': stdinSupportsAnsi,
+ 'stdoutSupportsAnsi': stdoutSupportsAnsi,
});
}
}
diff --git a/lib/src/testing/fake_platform.dart b/lib/src/testing/fake_platform.dart
index ceba4cd..16b8092 100644
--- a/lib/src/testing/fake_platform.dart
+++ b/lib/src/testing/fake_platform.dart
@@ -25,7 +25,8 @@
this.packageRoot,
this.packageConfig,
this.version,
- this.ansiSupported,
+ this.stdinSupportsAnsi,
+ this.stdoutSupportsAnsi,
});
/// Creates a new [FakePlatform] with properties whose initial values mirror
@@ -44,7 +45,8 @@
packageRoot = platform.packageRoot,
packageConfig = platform.packageConfig,
version = platform.version,
- ansiSupported = platform.ansiSupported;
+ stdinSupportsAnsi = platform.stdinSupportsAnsi,
+ stdoutSupportsAnsi = platform.stdoutSupportsAnsi;
/// Creates a new [FakePlatform] with properties extracted from the encoded
/// JSON string.
@@ -66,7 +68,8 @@
packageRoot: map['packageRoot'],
packageConfig: map['packageConfig'],
version: map['version'],
- ansiSupported: map['ansiSupported'],
+ stdinSupportsAnsi: map['stdinSupportsAnsi'],
+ stdoutSupportsAnsi: map['stdoutSupportsAnsi'],
);
}
@@ -107,5 +110,8 @@
String version;
@override
- bool ansiSupported;
+ bool stdinSupportsAnsi;
+
+ @override
+ bool stdoutSupportsAnsi;
}
diff --git a/pubspec.yaml b/pubspec.yaml
index 74f5564..ab7c8e9 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: platform
-version: 1.1.1
+version: 2.0.0
authors:
- Todd Volkert <tvolkert@google.com>
description: A pluggable, mockable platform abstraction for Dart.