Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: pkg/analyzer_experimental/lib/options.dart

Issue 16231008: Remove unused (and little used) cli flags from dartanalyzer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « editor/tools/plugins/com.google.dart.command.analyze/src/com/google/dart/command/analyze/AnalyzerOptions.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_experimental/lib/options.dart
===================================================================
--- pkg/analyzer_experimental/lib/options.dart (revision 23438)
+++ pkg/analyzer_experimental/lib/options.dart (working copy)
@@ -9,7 +9,7 @@
import 'dart:io';
-const _BINARY_NAME = 'analyzer';
+const _BINARY_NAME = 'dartanalyzer';
/**
* Analyzer commandline configuration options.
@@ -22,6 +22,9 @@
/** Whether to use machine format for error display */
final bool machineFormat;
+ /** Whether to display version information */
+ final bool displayVersion;
+
/** Whether to ignore unrecognized flags */
final bool ignoreUnrecognizedFlags;
@@ -48,7 +51,8 @@
*/
CommandLineOptions._fromArgs(ArgResults args)
: shouldBatch = args['batch'],
- machineFormat = args['machine-format'],
+ machineFormat = args['machine'],
+ displayVersion = args['version'],
ignoreUnrecognizedFlags = args['ignore-unrecognized-flags'],
showPackageWarnings = args['show-package-warnings'],
showSdkWarnings = args['show-sdk-warnings'],
@@ -87,20 +91,23 @@
defaultsTo: false, negatable: false)
..addOption('dart-sdk', help: 'The path to the Dart SDK')
..addOption('package-root', help: 'The path to the package root')
- ..addFlag('machine-format', help: 'Specify whether errors '
- 'should be in machine format',
+ ..addFlag('machine',
+ help: 'Print errors in a format suitable for parsing',
defaultsTo: false, negatable: false)
+ ..addFlag('version', help: 'Print the analyzer version',
+ defaultsTo: false, negatable: false)
..addFlag('ignore-unrecognized-flags',
help: 'Ignore unrecognized command line flags',
defaultsTo: false, negatable: false)
..addFlag('fatal-warnings', help: 'Treat non-type warnings as fatal',
defaultsTo: false, negatable: false)
- ..addFlag('show-package-warnings', help: 'Show warnings from package: imports',
- defaultsTo: false, negatable: false)
+ ..addFlag('show-package-warnings',
+ help: 'Show warnings from package: imports',
+ defaultsTo: false, negatable: false)
..addFlag('show-sdk-warnings', help: 'Show warnings from SDK imports',
- defaultsTo: false, negatable: false)
+ defaultsTo: false, negatable: false)
..addFlag('help', abbr: 'h', help: 'Display this help message',
- defaultsTo: false, negatable: false);
+ defaultsTo: false, negatable: false);
try {
var results = parser.parse(args);
@@ -116,6 +123,9 @@
_showUsage(parser);
exit(15);
}
+ } if (results['version']) {
+ print('$_BINARY_NAME version ${_getVersion()}');
+ exit(0);
} else {
if (results.rest.length == 0) {
_showUsage(parser);
@@ -136,6 +146,18 @@
print(parser.getUsage());
}
+ static String _getVersion() {
+ try {
+ Path path = new Path(new Options().script);
+ Path versionPath = path.directoryPath.append('..').append('version');
+ File versionFile = new File.fromPath(versionPath);
+
+ return versionFile.readAsStringSync().trim();
+ } catch (_) {
+ // This happens when the script is not running out of an SDK.
scheglov 2013/05/30 20:36:04 Unnecessary "not"?
devoncarew 2013/05/30 20:42:19 The exception is only thrown when the script is no
+ return "<unknown>";
+ }
+ }
}
/**
« no previous file with comments | « editor/tools/plugins/com.google.dart.command.analyze/src/com/google/dart/command/analyze/AnalyzerOptions.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698