diff --git a/lib/src/allow_anything_parser.dart b/lib/src/allow_anything_parser.dart index 39f8151..69472b3 100644 --- a/lib/src/allow_anything_parser.dart +++ b/lib/src/allow_anything_parser.dart @@ -36,7 +36,7 @@ class AllowAnythingParser implements ArgParser { bool negatable = true, void Function(bool)? callback, bool hide = false, - bool hideNegatable = false, + bool hideNegatedUsage = false, List aliases = const []}) { throw UnsupportedError( "ArgParser.allowAnything().addFlag() isn't supported."); diff --git a/lib/src/arg_parser.dart b/lib/src/arg_parser.dart index a3cb989..7bb21c7 100644 --- a/lib/src/arg_parser.dart +++ b/lib/src/arg_parser.dart @@ -119,9 +119,9 @@ class ArgParser { /// /// If [hide] is `true`, this option won't be included in [usage]. /// - /// If [hideNegatable] is `true`, the fact that this flag can be negated will + /// If [hideNegatedUsage] is `true`, the fact that this flag can be negated will /// not be documented in [usage]. - /// It is an error for [hideNegatable] to be `true` if [negatable] is `false`. + /// It is an error for [hideNegatedUsage] to be `true` if [negatable] is `false`. /// /// If [aliases] is provided, these are used as aliases for [name]. These /// aliases will not appear as keys in the [options] map. @@ -137,7 +137,7 @@ class ArgParser { bool negatable = true, void Function(bool)? callback, bool hide = false, - bool hideNegatable = false, + bool hideNegatedUsage = false, List aliases = const []}) { _addOption( name, @@ -151,7 +151,7 @@ class ArgParser { OptionType.flag, negatable: negatable, hide: hide, - hideNegatable: hideNegatable, + hideNegatedUsage: hideNegatedUsage, aliases: aliases); } @@ -291,7 +291,7 @@ class ArgParser { bool? splitCommas, bool mandatory = false, bool hide = false, - bool hideNegatable = false, + bool hideNegatedUsage = false, List aliases = const []}) { var allNames = [name, ...aliases]; if (allNames.any((name) => findByNameOrAlias(name) != null)) { @@ -313,9 +313,9 @@ class ArgParser { 'The option $name cannot be mandatory and have a default value.'); } - if (!negatable && hideNegatable) { + if (!negatable && hideNegatedUsage) { throw ArgumentError( - 'The option $name cannot have `hideNegatable` without being negatable.', + 'The option $name cannot have `hideNegatedUsage` without being negatable.', ); } @@ -325,7 +325,7 @@ class ArgParser { splitCommas: splitCommas, mandatory: mandatory, hide: hide, - hideNegatable: hideNegatable, + hideNegatedUsage: hideNegatedUsage, aliases: aliases); _options[name] = option; _optionsAndSeparators.add(option); diff --git a/lib/src/option.dart b/lib/src/option.dart index 58717ee..463e5e2 100644 --- a/lib/src/option.dart +++ b/lib/src/option.dart @@ -20,7 +20,7 @@ Option newOption( bool? splitCommas, bool mandatory = false, bool hide = false, - bool hideNegatable = false, + bool hideNegatedUsage = false, List aliases = const []}) { return Option._(name, abbr, help, valueHelp, allowed, allowedHelp, defaultsTo, callback, type, @@ -28,7 +28,7 @@ Option newOption( splitCommas: splitCommas, mandatory: mandatory, hide: hide, - hideNegatable: hideNegatable, + hideNegatedUsage: hideNegatedUsage, aliases: aliases); } @@ -71,7 +71,7 @@ class Option { /// Whether to document that this flag is [negatable]. /// /// This is `null` unless [type] is [OptionType.flag]. - final bool? hideNegatable; + final bool? hideNegatedUsage; /// The callback to invoke with the option's value when the option is parsed. final Function? callback; @@ -115,7 +115,7 @@ class Option { bool? splitCommas, this.mandatory = false, this.hide = false, - this.hideNegatable, + this.hideNegatedUsage, this.aliases = const []}) : allowed = allowed == null ? null : List.unmodifiable(allowed), allowedHelp = diff --git a/lib/src/usage.dart b/lib/src/usage.dart index c19d784..bd39f11 100644 --- a/lib/src/usage.dart +++ b/lib/src/usage.dart @@ -121,7 +121,7 @@ class _Usage { String _longOption(Option option) { String result; - if (option.negatable! && !option.hideNegatable!) { + if (option.negatable! && !option.hideNegatedUsage!) { result = '--[no-]${option.name}'; } else { result = '--${option.name}'; diff --git a/test/usage_test.dart b/test/usage_test.dart index 3edc5dc..6f5315b 100644 --- a/test/usage_test.dart +++ b/test/usage_test.dart @@ -16,9 +16,10 @@ void main() { '''); }); - test('negatable flags with hideNegatable don\'t show "no-" in title', () { + test('negatable flags with hideNegatedUsage don\'t show "no-" in title', + () { var parser = ArgParser(); - parser.addFlag('mode', help: 'The mode', hideNegatable: true); + parser.addFlag('mode', help: 'The mode', hideNegatedUsage: true); validateUsage(parser, ''' --mode The mode