| 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 import 'dart:io'; | 5 import 'dart:io'; |
| 6 | 6 |
| 7 import 'package:analyzer/src/summary/idl.dart'; | 7 import 'package:analyzer/src/summary/idl.dart'; |
| 8 import 'package:analyzer/src/summary/inspect.dart'; | 8 import 'package:analyzer/src/summary/inspect.dart'; |
| 9 import 'package:args/args.dart'; |
| 9 | 10 |
| 10 main(List<String> args) { | 11 main(List<String> args) { |
| 11 if (args.length != 1) { | 12 ArgParser argParser = new ArgParser()..addFlag('raw'); |
| 12 print('Usage: inspect PATH'); | 13 ArgResults argResults = argParser.parse(args); |
| 14 if (argResults.rest.length != 1) { |
| 15 print(argParser.usage); |
| 13 exitCode = 1; | 16 exitCode = 1; |
| 14 return; | 17 return; |
| 15 } | 18 } |
| 16 String path = args[0]; | 19 String path = argResults.rest[0]; |
| 17 List<int> bytes = new File(path).readAsBytesSync(); | 20 List<int> bytes = new File(path).readAsBytesSync(); |
| 18 PackageBundle bundle = new PackageBundle.fromBuffer(bytes); | 21 PackageBundle bundle = new PackageBundle.fromBuffer(bytes); |
| 19 SummaryInspector inspector = new SummaryInspector(); | 22 SummaryInspector inspector = new SummaryInspector(argResults['raw']); |
| 20 print(inspector.dumpPackageBundle(bundle).join('\n')); | 23 print(inspector.dumpPackageBundle(bundle).join('\n')); |
| 21 } | 24 } |
| OLD | NEW |