diff --git a/bin/angel.dart b/bin/angel.dart index 41e6e57d..f50713ba 100644 --- a/bin/angel.dart +++ b/bin/angel.dart @@ -11,6 +11,9 @@ main(List args) async { var runner = new CommandRunner("angel", "Command-line tools for the Angel framework."); + runner.argParser + .addFlag('verbose', help: 'Print verbose output', negatable: false); + runner ..addCommand(new DoctorCommand()) ..addCommand(new KeyCommand()) @@ -19,12 +22,16 @@ main(List args) async { ..addCommand(new RenameCommand()) ..addCommand(new MakeCommand()); - return await runner.run(args).then((_) {}).catchError((exc) { + return await runner.run(args).then((_) {}).catchError((exc, st) { if (exc is String) { stdout.writeln(exc); } else { stderr.writeln("Oops, something went wrong: $exc"); exitCode = 1; + + if (args.contains('--verbose')) { + stderr.writeln(st); + } } }); } diff --git a/lib/src/commands/install.dart b/lib/src/commands/install.dart index 2cff7b95..bc13e11f 100644 --- a/lib/src/commands/install.dart +++ b/lib/src/commands/install.dart @@ -73,7 +73,7 @@ class InstallCommand extends Command { throw 'No add-on named "$packageName" is installed. You might need to run `angel install --update`.'; print('Installing $packageName...'); - Map values = { + Map values = { 'project_name': pubspec.name, 'pubspec': pubspec, }; @@ -106,7 +106,7 @@ class InstallCommand extends Command { if (await promptFile.exists()) { var contents = await promptFile.readAsString(); var y = yaml.loadYamlDocument(contents); - var cfg = y.contents.value as Map; + var cfg = y.contents.value as Map; // Loads globs if (cfg['templates'] is List) { @@ -115,7 +115,7 @@ class InstallCommand extends Command { } if (cfg['values'] is Map) { - var val = cfg['values'] as Map; + var val = cfg['values'] as Map; for (var key in val.keys) { var desc = val[key]['description'] ?? key;