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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
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(allowTrailingOptions: true); |
55 argParser.addFlag('verbose', | 55 argParser.addFlag('verbose', |
56 abbr: 'v', negatable: false, help: "Turn on logging output."); | 56 abbr: 'v', negatable: false, help: "Turn on logging output."); |
| 57 argParser.addFlag('no-cache', help: "Disable caching."); |
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/'."); |
| 61 argParser.addFlag('logdog', |
| 62 negatable: false, help: "Pull test results from logdog."); |
60 return argParser; | 63 return argParser; |
61 } | 64 } |
62 | 65 |
63 void processArgResults(ArgResults argResults) { | 66 void processArgResults(ArgResults argResults) { |
64 if (argResults['verbose']) { | 67 if (argResults['verbose']) { |
65 LOG = true; | 68 LOG = true; |
66 } | 69 } |
67 if (argResults['cache'] != null) { | 70 if (argResults['cache'] != null) { |
68 cache.base = Uri.base.resolve('${argResults['cache']}/'); | 71 cache.base = Uri.base.resolve('${argResults['cache']}/'); |
69 } | 72 } |
| 73 if (argResults['no-cache']) { |
| 74 cache.base = null; |
| 75 } |
70 } | 76 } |
OLD | NEW |