Deprecate upper-case constants in favor of lowercase
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8771808..e3ff673 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 1.4.0
+
+* Deprecated `OptionType.FLAG`, `OptionType.SINGLE`, and `OptionType.MULTIPLE`
+ in favor of `OptionType.flag`, `OptionType.single`, and `OptionType.multiple`
+ which follow the style guide.
+
## 1.3.0
* Type `Command.run()`'s return value as `FutureOr<T>`.
diff --git a/lib/src/arg_parser.dart b/lib/src/arg_parser.dart
index ea8ede6..08234b9 100644
--- a/lib/src/arg_parser.dart
+++ b/lib/src/arg_parser.dart
@@ -121,7 +121,7 @@
null,
defaultsTo,
callback == null ? null : (value) => callback(value as bool),
- OptionType.FLAG,
+ OptionType.flag,
negatable: negatable,
hide: hide);
}
@@ -161,7 +161,7 @@
/// value will be `[]` rather than `null`, or `[defaultsTo]` if [defaultsTo]
/// is passed.
///
- /// If [splitCommas] is `true`, multiple options may be passed by writing
+ /// If [splitCommas] is `true`, multiple values may be passed by writing
/// `--option a,b` in addition to `--option a --option b`. It defaults to
/// `true` if [allowMultiple] is `true` and `false` otherwise.
///
@@ -189,7 +189,7 @@
}
_addOption(name, abbr, help, valueHelp, allowed, allowedHelp, defaultsTo,
- callback, allowMultiple ? OptionType.MULTIPLE : OptionType.SINGLE,
+ callback, allowMultiple ? OptionType.multiple : OptionType.single,
splitCommas: splitCommas, hide: hide);
}
diff --git a/lib/src/option.dart b/lib/src/option.dart
index b7bb62b..8d4a917 100644
--- a/lib/src/option.dart
+++ b/lib/src/option.dart
@@ -57,7 +57,7 @@
/// For example, if [name] is `flag`, the user can pass `--no-flag` to set its
/// value to `false`.
///
- /// This is `null` unless [type] is [OptionType.FLAG].
+ /// This is `null` unless [type] is [OptionType.flag].
final bool negatable;
/// The callback to invoke with the option's value when the option is parsed.
@@ -74,13 +74,13 @@
final bool hide;
/// Whether the option is boolean-valued flag.
- bool get isFlag => type == OptionType.FLAG;
+ bool get isFlag => type == OptionType.flag;
/// Whether the option takes a single value.
- bool get isSingle => type == OptionType.SINGLE;
+ bool get isSingle => type == OptionType.single;
/// Whether the option allows multiple values.
- bool get isMultiple => type == OptionType.MULTIPLE;
+ bool get isMultiple => type == OptionType.multiple;
Option._(
this.name,
@@ -102,7 +102,7 @@
// If the user doesn't specify [splitCommas], it defaults to true for
// multiple options.
this.splitCommas =
- splitCommas == null ? type == OptionType.MULTIPLE : splitCommas {
+ splitCommas == null ? type == OptionType.multiple : splitCommas {
if (name.isEmpty) {
throw new ArgumentError('Name cannot be empty.');
} else if (name.startsWith('-')) {
@@ -149,7 +149,10 @@
/// An option that can only be `true` or `false`.
///
/// The presence of the option name itself in the argument list means `true`.
- static const FLAG = const OptionType._("OptionType.FLAG");
+ static const flag = const OptionType._("OptionType.flag");
+
+ @Deprecated("Use OptionType.flag instead.")
+ static const FLAG = flag;
/// An option that takes a single value.
///
@@ -160,7 +163,10 @@
/// --mode=debug
///
/// If the option is passed more than once, the last one wins.
- static const SINGLE = const OptionType._("OptionType.SINGLE");
+ static const single = const OptionType._("OptionType.single");
+
+ @Deprecated("Use OptionType.single instead.")
+ static const SINGLE = single;
/// An option that allows multiple values.
///
@@ -170,7 +176,10 @@
///
/// In the parsed `ArgResults`, a multiple-valued option will always return
/// a list, even if one or no values were passed.
- static const MULTIPLE = const OptionType._("OptionType.MULTIPLE");
+ static const multiple = const OptionType._("OptionType.multiple");
+
+ @Deprecated("Use OptionType.multiple instead.")
+ static const MULTIPLE = multiple;
final String name;
diff --git a/pubspec.yaml b/pubspec.yaml
index 2c5fa59..4985ea2 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: args
-version: 1.3.0
+version: 1.4.0-dev
author: "Dart Team <misc@dartlang.org>"
homepage: https://github.com/dart-lang/args
description: >