| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library fasta.command_line; | 5 library fasta.command_line; |
| 6 | 6 |
| 7 import 'fasta_codes.dart' show Message, templateFastaCLIArgumentRequired; | 7 import 'fasta_codes.dart' show Message, templateFastaCLIArgumentRequired; |
| 8 | 8 |
| 9 import 'deprecated_problems.dart' | 9 import 'deprecated_problems.dart' show deprecated_inputError; |
| 10 show deprecated_inputError, deprecated_internalProblem; | 10 |
| 11 import 'problems.dart' show unhandled; |
| 11 | 12 |
| 12 deprecated_argumentError(Message usage, String message) { | 13 deprecated_argumentError(Message usage, String message) { |
| 13 if (usage != null) print(usage.message); | 14 if (usage != null) print(usage.message); |
| 14 deprecated_inputError(null, null, message); | 15 deprecated_inputError(null, null, message); |
| 15 } | 16 } |
| 16 | 17 |
| 17 argumentError(Message usage, Message message) { | 18 argumentError(Message usage, Message message) { |
| 18 if (usage != null) print(usage.message); | 19 if (usage != null) print(usage.message); |
| 19 deprecated_inputError(null, null, message.message); | 20 deprecated_inputError(null, null, message.message); |
| 20 } | 21 } |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 parsedValue = Uri.base.resolve(value); | 160 parsedValue = Uri.base.resolve(value); |
| 160 } else if (valueSpecification == String) { | 161 } else if (valueSpecification == String) { |
| 161 parsedValue = value; | 162 parsedValue = value; |
| 162 } else if (valueSpecification is String) { | 163 } else if (valueSpecification is String) { |
| 163 return deprecated_argumentError( | 164 return deprecated_argumentError( |
| 164 usage, | 165 usage, |
| 165 "Unrecognized value specification: " | 166 "Unrecognized value specification: " |
| 166 "'$valueSpecification', try using a type literal instead."); | 167 "'$valueSpecification', try using a type literal instead."); |
| 167 } else { | 168 } else { |
| 168 // All possible cases should have been handled above. | 169 // All possible cases should have been handled above. |
| 169 return deprecated_internalProblem("assertion failure"); | 170 return unhandled("${valueSpecification.runtimeType}", |
| 171 "CommandLine.parse", -1, null); |
| 170 } | 172 } |
| 171 result.options[argument] = parsedValue; | 173 result.options[argument] = parsedValue; |
| 172 break; | 174 break; |
| 173 | 175 |
| 174 default: | 176 default: |
| 175 return deprecated_argumentError(usage, | 177 return deprecated_argumentError(usage, |
| 176 "Unrecognized value specification: '$valueSpecification'."); | 178 "Unrecognized value specification: '$valueSpecification'."); |
| 177 } | 179 } |
| 178 } | 180 } |
| 179 } else if (argument == "/?" || argument == "/h") { | 181 } else if (argument == "/?" || argument == "/h") { |
| 180 result.options[argument] = true; | 182 result.options[argument] = true; |
| 181 } else { | 183 } else { |
| 182 result.arguments.add(argument); | 184 result.arguments.add(argument); |
| 183 } | 185 } |
| 184 } | 186 } |
| 185 result.arguments.addAll(nonOptions); | 187 result.arguments.addAll(nonOptions); |
| 186 return result; | 188 return result; |
| 187 } | 189 } |
| 188 } | 190 } |
| OLD | NEW |