OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 'package:args/args.dart'; | 5 import 'package:args/args.dart'; |
6 import 'package:args/command_runner.dart'; | 6 import 'package:args/command_runner.dart'; |
7 | 7 |
8 import 'entrypoint.dart'; | 8 import 'entrypoint.dart'; |
9 import 'log.dart' as log; | 9 import 'log.dart' as log; |
10 import 'global_packages.dart'; | 10 import 'global_packages.dart'; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } | 77 } |
78 | 78 |
79 /// Parses a user-supplied integer [intString] named [name]. | 79 /// Parses a user-supplied integer [intString] named [name]. |
80 /// | 80 /// |
81 /// If the parsing fails, prints a usage message and exits. | 81 /// If the parsing fails, prints a usage message and exits. |
82 int parseInt(String intString, String name) { | 82 int parseInt(String intString, String name) { |
83 try { | 83 try { |
84 return int.parse(intString); | 84 return int.parse(intString); |
85 } on FormatException catch (_) { | 85 } on FormatException catch (_) { |
86 usageException('Could not parse $name "$intString".'); | 86 usageException('Could not parse $name "$intString".'); |
| 87 return null; |
87 } | 88 } |
88 } | 89 } |
89 } | 90 } |
OLD | NEW |