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

Unified Diff: pkg/args/lib/src/options.dart

Issue 383913003: Add .wasParsed() to ArgResults. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove "-dev". Created 6 years, 5 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 | « pkg/args/lib/src/option.dart ('k') | pkg/args/lib/src/parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/args/lib/src/options.dart
diff --git a/pkg/args/lib/src/options.dart b/pkg/args/lib/src/options.dart
deleted file mode 100644
index 34dc8d30f39624e4988085e0eedb949023295ba4..0000000000000000000000000000000000000000
--- a/pkg/args/lib/src/options.dart
+++ /dev/null
@@ -1,54 +0,0 @@
-library options;
-
-import 'package:collection/wrappers.dart';
-
-/// A command-line option. Includes both flags and options which take a value.
-class Option {
- final String name;
- final String abbreviation;
- final List<String> allowed;
- final defaultValue;
- final Function callback;
- final String help;
- final String valueHelp;
- final Map<String, String> allowedHelp;
- final bool isFlag;
- final bool negatable;
- final bool allowMultiple;
- final bool hide;
-
- Option(this.name, this.abbreviation, this.help, this.valueHelp,
- List<String> allowed, Map<String, String> allowedHelp, this.defaultValue,
- this.callback, {this.isFlag, this.negatable, this.allowMultiple: false,
- this.hide: false}) :
- this.allowed = allowed == null ?
- null : new UnmodifiableListView(allowed),
- this.allowedHelp = allowedHelp == null ?
- null : new UnmodifiableMapView(allowedHelp) {
-
- if (name.isEmpty) {
- throw new ArgumentError('Name cannot be empty.');
- } else if (name.startsWith('-')) {
- throw new ArgumentError('Name $name cannot start with "-".');
- }
-
- // Ensure name does not contain any invalid characters.
- if (_invalidChars.hasMatch(name)) {
- throw new ArgumentError('Name "$name" contains invalid characters.');
- }
-
- if (abbreviation != null) {
- if (abbreviation.length != 1) {
- throw new ArgumentError('Abbreviation must be null or have length 1.');
- } else if(abbreviation == '-') {
- throw new ArgumentError('Abbreviation cannot be "-".');
- }
-
- if (_invalidChars.hasMatch(abbreviation)) {
- throw new ArgumentError('Abbreviation is an invalid character.');
- }
- }
- }
-
- static final _invalidChars = new RegExp(r'''[ \t\r\n"'\\/]''');
-}
« no previous file with comments | « pkg/args/lib/src/option.dart ('k') | pkg/args/lib/src/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698