OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:convert'; | 6 import 'dart:convert'; |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:args/args.dart'; | 9 import 'package:args/args.dart'; |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 /// Reads the content of [uri] as text. | 46 /// Reads the content of [uri] as text. |
47 Future<String> readUriAsText(HttpClient client, Uri uri) async { | 47 Future<String> readUriAsText(HttpClient client, Uri uri) async { |
48 HttpClientRequest request = await client.getUrl(uri); | 48 HttpClientRequest request = await client.getUrl(uri); |
49 HttpClientResponse response = await request.close(); | 49 HttpClientResponse response = await request.close(); |
50 return await response.transform(UTF8.decoder).join(); | 50 return await response.transform(UTF8.decoder).join(); |
51 } | 51 } |
52 | 52 |
53 ArgParser createArgParser() { | 53 ArgParser createArgParser() { |
54 ArgParser argParser = new ArgParser(); | 54 ArgParser argParser = new ArgParser(); |
| 55 argParser.addFlag('help', help: "Help"); |
55 argParser.addFlag('verbose', | 56 argParser.addFlag('verbose', |
56 abbr: 'v', negatable: false, help: "Turn on logging output."); | 57 abbr: 'v', negatable: false, help: "Turn on logging output."); |
57 argParser.addOption('cache', | 58 argParser.addOption('cache', |
58 help: "Use <dir> for caching test output.\n" | 59 help: "Use <dir> for caching test output.\n" |
59 "Defaults to 'temp/gardening-cache/'."); | 60 "Defaults to 'temp/gardening-cache/'."); |
60 return argParser; | 61 return argParser; |
61 } | 62 } |
62 | 63 |
63 void processArgResults(ArgResults argResults) { | 64 void processArgResults(ArgResults argResults) { |
64 if (argResults['verbose']) { | 65 if (argResults['verbose']) { |
65 LOG = true; | 66 LOG = true; |
66 } | 67 } |
67 if (argResults['cache'] != null) { | 68 if (argResults['cache'] != null) { |
68 cache.base = Uri.base.resolve('${argResults['cache']}/'); | 69 cache.base = Uri.base.resolve('${argResults['cache']}/'); |
69 } | 70 } |
70 } | 71 } |
OLD | NEW |