| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 part of cli; | 5 part of cli; |
| 6 | 6 |
| 7 // Splits a line into a list of string args. Each arg retains any | 7 // Splits a line into a list of string args. Each arg retains any |
| 8 // trailing whitespace so that we can reconstruct the original command | 8 // trailing whitespace so that we can reconstruct the original command |
| 9 // line from the pieces. | 9 // line from the pieces. |
| 10 List<String> _splitLine(String line) { | 10 List<String> _splitLine(String line) { |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 return name; | 246 return name; |
| 247 } else { | 247 } else { |
| 248 Command parent = _parent; | 248 Command parent = _parent; |
| 249 return '${parent.fullName} $name'; | 249 return '${parent.fullName} $name'; |
| 250 } | 250 } |
| 251 } | 251 } |
| 252 | 252 |
| 253 toString() => 'Command(${name})'; | 253 toString() => 'Command(${name})'; |
| 254 } | 254 } |
| 255 | 255 |
| 256 abstract class CommandException implements Exception { | 256 abstract class CommandException implements Exception {} |
| 257 } | |
| 258 | 257 |
| 259 class AmbiguousCommandException extends CommandException { | 258 class AmbiguousCommandException extends CommandException { |
| 260 AmbiguousCommandException(this.command, this.matches); | 259 AmbiguousCommandException(this.command, this.matches); |
| 261 | 260 |
| 262 final String command; | 261 final String command; |
| 263 final List<Command> matches; | 262 final List<Command> matches; |
| 264 | 263 |
| 265 @override | 264 @override |
| 266 String toString() { | 265 String toString() { |
| 267 List<String> matchNames = matches.map( | 266 List<String> matchNames = |
| 268 (Command command) => '${command.fullName}').toList(); | 267 matches.map((Command command) => '${command.fullName}').toList(); |
| 269 return "Command '$command' is ambiguous: $matchNames"; | 268 return "Command '$command' is ambiguous: $matchNames"; |
| 270 } | 269 } |
| 271 } | 270 } |
| 272 | 271 |
| 273 class NoSuchCommandException extends CommandException { | 272 class NoSuchCommandException extends CommandException { |
| 274 NoSuchCommandException(this.command); | 273 NoSuchCommandException(this.command); |
| 275 | 274 |
| 276 final String command; | 275 final String command; |
| 277 | 276 |
| 278 @override | 277 @override |
| 279 String toString() => "No such command: '$command'"; | 278 String toString() => "No such command: '$command'"; |
| 280 } | 279 } |
| OLD | NEW |