diff --git a/runtime/tools/heapsnapshot/bin/explore.dart b/runtime/tools/heapsnapshot/bin/explore.dart index 3cdf9a73f5f..22b6356022a 100644 --- a/runtime/tools/heapsnapshot/bin/explore.dart +++ b/runtime/tools/heapsnapshot/bin/explore.dart @@ -50,7 +50,7 @@ class CompletionKeyHandler extends KeyHandler { } } -void main() async { +Future main(List args) async { final console = SmartConsole(); console.write('The '); @@ -67,6 +67,24 @@ void main() async { console.completionHandler = CompletionKeyHandler(cliState); + if (args.isNotEmpty) { + if (args.length == 1 && args.single.trim().isNotEmpty) { + console.setForegroundColor(ConsoleColor.brightYellow); + console.writeLine('Will try to load ${args.single.trim()}.'); + console.resetColorAttributes(); + console.writeLine(''); + if (await cliCommandRunner.run(cliState, ['load', args.single.trim()])) { + return; + } + } else { + console.setForegroundColor(ConsoleColor.brightRed); + console.writeLine('When giving arguments, only one argument - ' + 'the snapshot to load - is supported. Ignoring arguments.'); + console.resetColorAttributes(); + console.writeLine(''); + } + } + while (true) { final response = console.smartReadLine(); console.resetColorAttributes();