Skip to content

Commit 5389620

Browse files
committed
Replace quectocolors with io
Avoid third_party dependencies from core Dart team repos.
1 parent 14fdb72 commit 5389620

2 files changed

Lines changed: 59 additions & 58 deletions

File tree

pkgs/args/example/arg_parser/ansi_example.dart

Lines changed: 58 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,41 @@ library;
1010
import 'dart:io';
1111

1212
import 'package:args/args.dart';
13-
import 'package:quectocolors/quectocolors.dart';
13+
import 'package:io/ansi.dart';
1414

1515
void main() {
1616
var parser = ArgParser();
1717

1818
parser.addSeparator('===== Platform');
1919

20-
final javaScriptStyled = 'JavaScript'.chartreuse.italic;
20+
final javaScriptStyled = styleItalic.wrap(lightGreen.wrap('JavaScript'));
2121

2222
parser.addOption('compiler',
2323
abbr: 'c',
2424
defaultsTo: 'none',
25-
help: 'Specify any compilation step (if needed).'.blue,
25+
help: blue.wrap('Specify any compilation step (if needed).'),
2626
allowed: [
2727
'none',
2828
'dart2js',
2929
'dartc'
3030
],
3131
allowedHelp: {
32-
'none': 'Do not compile the Dart code (run native Dart code on the'
33-
' VM).\n(only valid with the following runtimes: vm, drt)'
34-
.red,
35-
'dart2js':
36-
'Compile dart code to $javaScriptStyled by running dart2js.\n'
37-
'(only valid with the following runtimes: d8, drt, chrome\n'
38-
'safari, ie, firefox, opera, none (compile only))'
39-
.green,
40-
'dartc': 'Perform static analysis on Dart code by running dartc.\n'
41-
'(only valid with the following runtimes: none)'
42-
.cornflowerBlue,
32+
'none':
33+
red.wrap('Do not compile the Dart code (run native Dart code on the'
34+
' VM).\n(only valid with the following runtimes: vm, drt)')!,
35+
'dart2js': green
36+
.wrap('Compile dart code to $javaScriptStyled by running dart2js.\n'
37+
'(only valid with the following runtimes: d8, drt, chrome\n'
38+
'safari, ie, firefox, opera, none (compile only))')!,
39+
'dartc': lightBlue
40+
.wrap('Perform static analysis on Dart code by running dartc.\n'
41+
'(only valid with the following runtimes: none)')!,
4342
});
4443

4544
parser.addOption('runtime',
4645
abbr: 'r',
4746
defaultsTo: 'vm',
48-
help: 'Where the tests should be run.'.magenta,
47+
help: magenta.wrap('Where the tests should be run.'),
4948
allowed: [
5049
'vm',
5150
'd8',
@@ -60,75 +59,77 @@ void main() {
6059
'none'
6160
],
6261
allowedHelp: {
63-
'vm': 'Run Dart code on the standalone dart vm.'.teal,
64-
'd8': 'Run $javaScriptStyled from the command line using v8.'.yellow,
65-
'drt':
62+
'vm': cyan.wrap('Run Dart code on the standalone dart vm.')!,
63+
'd8': yellow
64+
.wrap('Run $javaScriptStyled from the command line using v8.')!,
65+
'drt': lightGreen.wrap(
6666
'Run Dart or $javaScriptStyled in the headless version of Chrome,\n'
67-
'content shell.'
68-
.lightGreen,
69-
'dartium': 'Run Dart or $javaScriptStyled in Dartium.'.lightBlue,
70-
'ff': 'Run $javaScriptStyled in Firefox'.pink,
71-
'chrome': 'Run $javaScriptStyled in Chrome'.orange,
72-
'safari': 'Run $javaScriptStyled in Safari'.purple,
73-
'ie': 'Run $javaScriptStyled in Internet Explorer'.cyan,
74-
'opera': 'Run $javaScriptStyled in Opera'.brightYellow,
75-
'none': 'No runtime, compile only (for example, used for dartc static\n'
76-
'analysis tests).'
77-
.grey,
67+
'content shell.')!,
68+
'dartium': lightBlue.wrap('Run Dart or $javaScriptStyled in Dartium.')!,
69+
'ff': lightRed.wrap('Run $javaScriptStyled in Firefox')!,
70+
'chrome': yellow.wrap('Run $javaScriptStyled in Chrome')!,
71+
'safari': magenta.wrap('Run $javaScriptStyled in Safari')!,
72+
'ie': cyan.wrap('Run $javaScriptStyled in Internet Explorer')!,
73+
'opera': lightYellow.wrap('Run $javaScriptStyled in Opera')!,
74+
'none': darkGray.wrap(
75+
'No runtime, compile only (for example, used for dartc static\n'
76+
'analysis tests).')!,
7877
});
7978

8079
parser.addOption('arch',
8180
abbr: 'a',
8281
defaultsTo: 'ia32',
83-
help: 'The architecture to run tests for'.cyan,
82+
help: cyan.wrap('The architecture to run tests for'),
8483
allowed: ['all', 'ia32', 'x64', 'simarm']);
8584

8685
parser.addOption('system',
8786
abbr: 's',
8887
defaultsTo: Platform.operatingSystem,
89-
help: 'The operating system to run tests on'.gold,
88+
help: yellow.wrap('The operating system to run tests on'),
9089
allowed: ['linux', 'macos', 'windows']);
9190

9291
parser.addSeparator('===== Runtime');
9392

9493
parser.addOption('mode',
9594
abbr: 'm',
9695
defaultsTo: 'debug',
97-
help: 'Mode in which to run the tests'.lavender,
96+
help: lightMagenta.wrap('Mode in which to run the tests'),
9897
allowed: ['all', 'debug', 'release']);
9998

10099
parser.addFlag('checked',
101-
defaultsTo: false, help: 'Run tests in checked mode'.lime);
100+
defaultsTo: false, help: lightGreen.wrap('Run tests in checked mode'));
102101

103102
parser.addFlag('host-checked',
104-
defaultsTo: false, help: 'Run compiler in checked mode'.maroon);
103+
defaultsTo: false, help: red.wrap('Run compiler in checked mode'));
105104

106-
parser.addOption('timeout', abbr: 't', help: 'Timeout in seconds'.mintCream);
105+
parser.addOption('timeout',
106+
abbr: 't', help: white.wrap('Timeout in seconds'));
107107

108108
parser.addOption('tasks',
109109
abbr: 'j',
110110
defaultsTo: Platform.numberOfProcessors.toString(),
111-
help: 'The number of parallel tasks to run'.navy.onBrightWhite);
111+
help: backgroundWhite
112+
.wrap(blue.wrap('The number of parallel tasks to run')));
112113

113114
parser.addOption('shards',
114115
defaultsTo: '1',
115-
help:
116-
'The number of instances that the tests will be sharded over'.olive);
116+
help: green
117+
.wrap('The number of instances that the tests will be sharded over'));
117118

118119
parser.addOption('shard',
119120
defaultsTo: '1',
120-
help:
121-
'The index of this instance when running in sharded mode'.peachPuff);
121+
help: lightYellow
122+
.wrap('The index of this instance when running in sharded mode'));
122123

123124
parser.addFlag('valgrind',
124-
defaultsTo: false, help: 'Run tests through valgrind'.salmon);
125+
defaultsTo: false, help: lightRed.wrap('Run tests through valgrind'));
125126

126127
parser.addSeparator('===== Output');
127128

128129
parser.addOption('progress',
129130
abbr: 'p',
130131
defaultsTo: 'compact',
131-
help: 'Progress indication mode'.skyBlue,
132+
help: lightBlue.wrap('Progress indication mode'),
132133
allowed: [
133134
'compact',
134135
'color',
@@ -141,32 +142,32 @@ void main() {
141142

142143
parser.addFlag('report',
143144
defaultsTo: false,
144-
help:
145-
'Print a summary report of the number of tests, by expectation'.plum);
145+
help: lightMagenta.wrap(
146+
'Print a summary report of the number of tests, by expectation'));
146147

147148
parser.addFlag('verbose',
148-
abbr: 'v', defaultsTo: false, help: 'Verbose output'.rosyBrown);
149+
abbr: 'v', defaultsTo: false, help: red.wrap('Verbose output'));
149150

150151
parser.addFlag('list',
151-
defaultsTo: false, help: 'List tests only, do not run them'.royalBlue);
152+
defaultsTo: false, help: blue.wrap('List tests only, do not run them'));
152153

153154
parser.addFlag('time',
154-
help: 'Print timings information after running tests'.seaGreen,
155+
help: green.wrap('Print timings information after running tests'),
155156
defaultsTo: false);
156157

157158
parser.addFlag('batch',
158159
abbr: 'b',
159-
help: 'Run browser tests in batch mode'.slateBlue,
160+
help: blue.wrap('Run browser tests in batch mode'),
160161
defaultsTo: true);
161162

162163
parser.addSeparator('===== Miscellaneous');
163164

164165
parser.addFlag('keep-generated-tests',
165166
defaultsTo: false,
166-
help: 'Keep the generated files in the temporary directory'.steelBlue);
167+
help: lightBlue
168+
.wrap('Keep the generated files in the temporary directory'));
167169

168-
parser.addOption('special-command',
169-
help: """
170+
parser.addOption('special-command', help: lightMagenta.wrap("""
170171
Special command support. Wraps the command line in
171172
a special command. The special command should contain
172173
an '@' character which will be replaced by the normal
@@ -175,15 +176,15 @@ command.
175176
For example if the normal command that will be executed
176177
is 'dart file.dart' and you specify special command
177178
'python -u valgrind.py @ suffix' the final command will be
178-
'python -u valgrind.py dart file.dart suffix'"""
179-
.brightMagenta);
179+
'python -u valgrind.py dart file.dart suffix'"""));
180180

181-
parser.addOption('dart', help: 'Path to dart executable'.tan);
182-
parser.addOption('drt', help: 'Path to content shell executable'.thistle);
181+
parser.addOption('dart', help: yellow.wrap('Path to dart executable'));
182+
parser.addOption('drt',
183+
help: lightMagenta.wrap('Path to content shell executable'));
183184
parser.addOption('dartium',
184-
help: 'Path to Dartium Chrome executable'.turquoise);
185+
help: lightCyan.wrap('Path to Dartium Chrome executable'));
185186
parser.addOption('mandatory',
186-
help: 'A mandatory option'.violet, mandatory: true);
187+
help: magenta.wrap('A mandatory option'), mandatory: true);
187188

188189
print(parser.usage);
189190
}

pkgs/args/example/arg_parser/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ environment:
1313
dependencies:
1414
args:
1515
path: ../..
16-
quectocolors: ^1.1.1
16+
io: ^1.0.0

0 commit comments

Comments
 (0)