Index: pkg/dev_compiler/lib/src/compiler/command.dart |
diff --git a/pkg/dev_compiler/lib/src/compiler/command.dart b/pkg/dev_compiler/lib/src/compiler/command.dart |
index 878070fbc1efc8077740289bfe36eee8422c9cc2..0b8a45b07aa5aaf8dff6030b54e3eda8efdc7dd3 100644 |
--- a/pkg/dev_compiler/lib/src/compiler/command.dart |
+++ b/pkg/dev_compiler/lib/src/compiler/command.dart |
@@ -14,22 +14,7 @@ import '../analyzer/context.dart' show AnalyzerOptions, parseDeclaredVariables; |
import 'compiler.dart' show BuildUnit, CompilerOptions, ModuleCompiler; |
import 'module_builder.dart'; |
-final ArgParser _argParser = () { |
- var argParser = new ArgParser(allowTrailingOptions: true) |
- ..addFlag('help', abbr: 'h', help: 'Display this message.') |
- ..addOption('out', |
- abbr: 'o', allowMultiple: true, help: 'Output file (required).') |
- ..addOption('module-root', |
- help: 'Root module directory.\n' |
- 'Generated module paths are relative to this root.') |
- ..addOption('library-root', |
- help: 'Root of source files.\n' |
- 'Generated library names are relative to this root.'); |
- addModuleFormatOptions(argParser, allowMultiple: true); |
- AnalyzerOptions.addArguments(argParser); |
- CompilerOptions.addArguments(argParser); |
- return argParser; |
-}(); |
+bool _verbose = false; |
/// Runs a single compile for dartdevc. |
/// |
@@ -41,7 +26,8 @@ int compile(List<String> args, {void printFn(Object obj)}) { |
ArgResults argResults; |
var declaredVars = <String, String>{}; |
try { |
- argResults = _argParser.parse(parseDeclaredVariables(args, declaredVars)); |
+ argResults = _argParser().parse(parseDeclaredVariables(args, declaredVars)); |
+ _verbose = argResults['verbose']; |
} on FormatException catch (error) { |
printFn('$error\n\n$_usageMessage'); |
return 64; |
@@ -80,6 +66,28 @@ $stackTrace |
} |
} |
+ArgParser _argParser({bool hide: true}) { |
+ var argParser = new ArgParser(allowTrailingOptions: true) |
+ ..addFlag('help', |
+ abbr: 'h', |
+ help: 'Display this message.\n' |
+ 'Add --verbose to show hidden options.', |
+ negatable: false) |
+ ..addFlag('verbose', abbr: 'v', help: 'Verbose output.') |
+ ..addOption('out', |
+ abbr: 'o', allowMultiple: true, help: 'Output file (required).') |
+ ..addOption('module-root', |
+ help: 'Root module directory.\n' |
+ 'Generated module paths are relative to this root.') |
+ ..addOption('library-root', |
+ help: 'Root of source files.\n' |
+ 'Generated library names are relative to this root.'); |
+ addModuleFormatOptions(argParser, allowMultiple: true, hide: hide); |
+ AnalyzerOptions.addArguments(argParser, hide: hide); |
+ CompilerOptions.addArguments(argParser, hide: hide); |
+ return argParser; |
+} |
+ |
bool _changed(List<int> list1, List<int> list2) { |
var length = list1.length; |
if (length != list2.length) return true; |
@@ -198,9 +206,9 @@ String _moduleForLibrary( |
return null; // unreachable |
} |
-final _usageMessage = |
+String get _usageMessage => |
'Dart Development Compiler compiles Dart into a JavaScript module.' |
- '\n\n${_argParser.usage}'; |
+ '\n\n${_argParser(hide: !_verbose).usage}'; |
void _usageException(String message) { |
throw new UsageException(message, _usageMessage); |