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

Unified Diff: lib/src/parser.dart

Issue 849023002: format code, removed unused variables and deprecated usage (Closed) Base URL: https://github.com/dart-lang/args.git@master
Patch Set: nits Created 5 years, 11 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 | « lib/src/option.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/parser.dart
diff --git a/lib/src/parser.dart b/lib/src/parser.dart
index 9cd141c00a334b63b6ac491d5c38deb05aea510b..1e297b0e68b35069f57527e85ac3f6d8a63e781f 100644
--- a/lib/src/parser.dart
+++ b/lib/src/parser.dart
@@ -92,8 +92,8 @@ class Parser {
// Add in the leftover arguments we didn't parse to the innermost command.
rest.addAll(args);
args.clear();
- return newArgResults(grammar, results, commandName, commandResults, rest,
- arguments);
+ return newArgResults(
+ grammar, results, commandName, commandResults, rest, arguments);
}
/// Pulls the value for [option] from the second argument in [args].
@@ -101,8 +101,7 @@ class Parser {
/// Validates that there is a valid value there.
void readNextArgAsValue(Option option) {
// Take the option argument from the next command line arg.
- validate(args.length > 0,
- 'Missing argument for "${option.name}".');
+ validate(args.length > 0, 'Missing argument for "${option.name}".');
// Make sure it isn't an option itself.
validate(!_ABBR_OPT.hasMatch(current) && !_LONG_OPT.hasMatch(current),
@@ -124,8 +123,8 @@ class Parser {
var option = grammar.findByAbbreviation(soloOpt[1]);
if (option == null) {
// Walk up to the parent command if possible.
- validate(parent != null,
- 'Could not find an option or flag "-${soloOpt[1]}".');
+ validate(
+ parent != null, 'Could not find an option or flag "-${soloOpt[1]}".');
return parent.parseSoloOption();
}
@@ -153,8 +152,8 @@ class Parser {
var first = grammar.findByAbbreviation(c);
if (first == null) {
// Walk up to the parent command if possible.
- validate(parent != null,
- 'Could not find an option with short name "-$c".');
+ validate(
+ parent != null, 'Could not find an option with short name "-$c".');
return parent.parseAbbreviation(innermostCommand);
} else if (!first.isFlag) {
// The first character is a non-flag option, so the rest must be the
@@ -165,8 +164,8 @@ class Parser {
// If we got some non-flag characters, then it must be a value, but
// if we got here, it's a flag, which is wrong.
validate(abbrOpt[2] == '',
- 'Option "-$c" is a flag and cannot handle value '
- '"${abbrOpt[1].substring(1)}${abbrOpt[2]}".');
+ 'Option "-$c" is a flag and cannot handle value '
+ '"${abbrOpt[1].substring(1)}${abbrOpt[2]}".');
// Not an option, so all characters should be flags.
// We use "innermostCommand" here so that if a parent command parses the
@@ -186,16 +185,16 @@ class Parser {
var option = grammar.findByAbbreviation(c);
if (option == null) {
// Walk up to the parent command if possible.
- validate(parent != null,
- 'Could not find an option with short name "-$c".');
+ validate(
+ parent != null, 'Could not find an option with short name "-$c".');
parent.parseShortFlag(c);
return;
}
// In a list of short options, only the first can be a non-flag. If
// we get here we've checked that already.
- validate(option.isFlag,
- 'Option "-$c" must be a flag to be in a collapsed "-".');
+ validate(
+ option.isFlag, 'Option "-$c" must be a flag to be in a collapsed "-".');
setOption(results, option, true);
}
« no previous file with comments | « lib/src/option.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698