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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 if (argResults['cache'] != null) { | 101 if (argResults['cache'] != null) { |
102 cache.base = Uri.base.resolve('${argResults['cache']}/'); | 102 cache.base = Uri.base.resolve('${argResults['cache']}/'); |
103 } | 103 } |
104 if (argResults['no-cache']) { | 104 if (argResults['no-cache']) { |
105 cache.base = null; | 105 cache.base = null; |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
109 /// Strips un-wanted characters from string [category] from CBE json. | 109 /// Strips un-wanted characters from string [category] from CBE json. |
110 String sanitizeCategory(String category) { | 110 String sanitizeCategory(String category) { |
111 // Category name starts with either two or three numbers and | 111 var reg = new RegExp(r"^[0-9]+(.*)\|all$"); |
112 // end with |all. Instead of doing any fancy regular-expr, | 112 var match = reg.firstMatch(category); |
113 // we just test if third char is a number. | 113 return match != null ? match.group(1) : category; |
114 return category.substring( | |
115 category.codeUnitAt(2) <= 64 ? 3 : 2, category.length - 4); | |
116 } | 114 } |
OLD | NEW |