Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Unified Diff: tools/migration/lib/src/log.dart

Issue 2987533002: Add simple test migration helper. (Closed)
Patch Set: Merge branch 'master' into migration-tool Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/migration/bin/migrate_batch.dart ('k') | tools/migration/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/migration/lib/src/log.dart
diff --git a/tools/migration/lib/src/log.dart b/tools/migration/lib/src/log.dart
new file mode 100644
index 0000000000000000000000000000000000000000..f905bdd1e967617f6114ee6aa07e2755560c3fca
--- /dev/null
+++ b/tools/migration/lib/src/log.dart
@@ -0,0 +1,49 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// 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';
+
+final _cyan = _getSpecial('\u001b[36m');
+final _green = _getSpecial('\u001b[32m');
+final _magenta = _getSpecial('\u001b[35m');
+final _red = _getSpecial('\u001b[31m');
+final _yellow = _getSpecial('\u001b[33m');
+final _blue = _getSpecial('\u001b[34m');
+final _gray = _getSpecial('\u001b[1;30m');
+final _none = _getSpecial('\u001b[0m');
+final _noColor = _getSpecial('\u001b[39m');
+final _bold = _getSpecial('\u001b[1m');
+
+void done(Object message) {
+ print(" ${green('(DONE)')} $message");
+}
+
+void note(Object message) {
+ print(" ${cyan('(NOTE)')} $message");
+}
+
+void todo(Object message) {
+ print("${red('(TODO)')} $message");
+}
+
+String bold(text) => "$_bold$text$_none";
+
+String cyan(text) => "$_cyan$text$_noColor";
+
+String green(text) => "$_green$text$_noColor";
+
+String red(text) => "$_red$text$_noColor";
+
+/// Gets a "special" string (ANSI escape or Unicode).
+///
+/// On Windows or when not printing to a terminal, returns something else since
+/// those aren't supported.
+String _getSpecial(String special, [String onWindows = '']) {
+ if (Platform.operatingSystem == 'windows' ||
+ stdioType(stdout) != StdioType.TERMINAL) {
+ return onWindows;
+ }
+
+ return special;
+}
« no previous file with comments | « tools/migration/bin/migrate_batch.dart ('k') | tools/migration/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698