args
Library for defining parsers for parsing raw command-line arguments into a set of options and values using GNU and POSIX style options.
2.7.0
9.8M downloads/mo
#29 most downloaded on pub.dev
dart-lang/core
What this package is like to depend on
Last release 1 years ago
12 Mar 2025
Release timing varies
gaps range from 3 weeks to 10 months
Some releases are documented
notes for 58 of 135 stable releases
Nothing withdrawn
no release was ever pulled
14 years old
136 releases · first in 2012
0 releases in the last 12 months
see the full history below
Release timeline
136 releases · Nov 2012 to Mar 2025Releases
latest 60 of 136-
2.7.012 Mar 2025Release notes
Open source →- Remove sorting of the
allowedHelpargument in usage output. Ordering will
depend on key order for the passedMap. - Fix the repository URL in
pubspec.yaml. - Added option
hideNegatedUsagetoArgParser.flag()allowing a flag to be
negatablewithout showing it in the usage text. - Fixed #101, adding check for mandatory when using
.option().
Release notes
Open source →- Remove sorting of the
allowedHelpargument in usage output. Ordering will depend on key order for the passedMap. - Fix the repository URL in
pubspec.yaml. - Added option
hideNegatedUsagetoArgParser.flag()allowing a flag to benegatablewithout showing it in the usage text. - Fixed #101, adding check for mandatory when using
.option().
- Remove sorting of the
-
2.6.014 Oct 2024Release notes
Open source →- Added source argument when throwing a
ArgParserException. - Fix inconsistent
FormatExceptionmessages - Require Dart 3.3
- Move to
dart-lang/coremonorepo.
- Added source argument when throwing a
-
2.5.011 Apr 2024Release notes
Open source →- Introduce new typed
ArgResultsflag(String),option(String), andmultiOption(String)methods. - Require Dart 3.0.
- Introduce new typed
-
2.4.205 Jun 2023Release notes
Open source →- Change the validation of
mandatoryoptions; they now perform validation when the value is retrieved (from theArgResultsobject), instead of when the args are parsed. - Require Dart 2.19.
- Change the validation of
-
2.4.103 May 2023Release notes
Open source →- Add a
CONTRIBUTING.mdfile; move the publishing automation docs from the readme into the contributing doc. - Added package topics to the pubspec file.
- Add a
-
2.4.010 Feb 2023Release notes
Open source →- Command suggestions will now also suggest based on aliases of a command.
- Introduce getter
Command.suggestionAliasesfor names that cannot be used as aliases, but will trigger suggestions.
-
2.3.219 Jan 2023 -
2.3.111 May 2022Release notes
Open source →- Switch to using package:lints.
- Address an issue with the readme API documentation (#211).
- Populate the pubspec
repositoryfield.
-
2.3.013 Sep 2021 -
2.2.022 Jul 2021Release notes
Open source →- Suggest similar commands if an unknown command is encountered, when using the
CommandRunner.- The max edit distance for suggestions defaults to 2, but can be configured
using the
suggestionDistanceLimitparameter on the constructor. You can set it to0to disable the feature.
- The max edit distance for suggestions defaults to 2, but can be configured
using the
- Suggest similar commands if an unknown command is encountered, when using the
-
2.1.101 Jun 2021Release notes
Open source →- Fix a bug with
mandatoryoptions which caused a null assertion failure when used within a command.
- Fix a bug with
-
2.1.022 Apr 2021Release notes
Open source →- Add a
mandatoryargument to require the presence of an option. - Add
aliasesnamed argument toaddFlag,addOption, andaddMultiOption, as well as a publicfindByNameOrAliasmethod onArgParser. This allows you to provide aliases for an argument name, which eases the transition from one argument name to another.
- Add a
-
2.0.005 Feb 2021 -
2.0.0-nullsafety.030 Dec 2020 pre-releaseRelease notes
Open source →-
Migrate to null safety.
-
BREAKING Remove APIs that had been marked as deprecated:
- Instead of the
allowMultiandsplitCommasarguments toArgParser.addOption(), useArgParser.addMultiOption(). - Instead of
ArgParser.getUsage(), useArgParser.usage. - Instead of
Option.abbreviation, useOption.abbr. - Instead of
Option.defaultValue, useOption.defaultsTo. - Instead of
OptionType.FLAG/SINGLE/MULTIPLE, useOptionType.flag/single/multiple.
- Instead of the
-
Add a more specific function type to the
callbackargument ofaddOption.
-
-
1.6.017 Mar 2020Release notes
Open source →- Remove
helpfrom the list of commands in usage. - Remove the blank lines in usage which separated the help for options that happened to span multiple lines.
- Remove
-
1.5.416 Mar 2020Release notes
Open source →- Fix a bug with option names containing underscores.
- Point towards
CommandRunnerin the docs forArgParser.addCommandsince it is what most authors will want to use instead.
-
1.5.328 Feb 2020Release notes
Open source →- Improve arg parsing performance: use queues instead of lists internally to get linear instead of quadratic performance, which is important for large numbers of args (>1000). And, use simple string manipulation instead of regular expressions for a 1.5x improvement everywhere.
- No longer automatically add a 'help' option to commands that don't validate their arguments (fix #123).
-
1.5.231 May 2019 -
1.5.108 Nov 2018 -
1.5.002 Aug 2018 -
1.4.418 Jul 2018 -
1.4.324 Apr 2018 -
1.4.209 Apr 2018Release notes
Open source →- Narrow the SDK constraint to only allow SDK versions that support
FutureOr.
- Narrow the SDK constraint to only allow SDK versions that support
-
1.4.123 Feb 2018Release notes
Open source →- Run
dart formatwith the new style. - Performance improvement for non-BMP characters.
Release notes
Open source →- Fix the way default values for multi-valued options are printed in argument usage.
- Run
-
1.4.022 Feb 2018Release notes
Open source →-
Deprecated
OptionType.FLAG,OptionType.SINGLE, andOptionType.MULTIPLEin favor ofOptionType.flag,OptionType.single, andOptionType.multiplewhich follow the style guide. -
Deprecated
Option.abbreviationandOption.defaultValuein favor ofOption.abbrandOption.defaultsTo. This makes all ofOption's fields match the corresponding parameters toArgParser.addOption(). -
Deprecated the
allowMultipleandsplitCommasarguments toArgParser.addOption()in favor of a separateArgParser.addMultiOption()method. This allows us to provide more accurate type information, and to avoid adding flags that only make sense for multi-options in places where they might be usable for single-value options.
-
-
1.3.026 Jan 2018 -
1.2.006 Dec 2017Release notes
Open source →- Type the
callbackparameter toArgParser.addOption()asFunctionrather thanvoid Function(value). This allows strong-mode users to writecallback: (String value) { ... }rather than having to manually castvalueto aString(or aList<String>withallowMultiple: true).
- Type the
-
1.1.027 Nov 2017Release notes
Open source →-
ArgParser.parse()now takes anIterable<String>rather than aList<String>. -
ArgParser.addOption()'sallowedoption now takes anIterable<String>rather than aList<String>.
-
-
1.0.219 Oct 2017 -
1.0.103 Oct 2017 -
1.0.014 Jun 2017Release notes
Open source →-
Breaking change: The
allowTrailingOptionsargument tonew ArgumentParser()defaults totrueinstead offalse. -
Add
new ArgParser.allowAnything(). This allows any input, without parsing any options.
-
-
0.13.711 Nov 2016Release notes
Open source →-
Add explicit support for forwarding the value returned by
Command.run()toCommandRunner.run(). This worked unintentionally prior to 0.13.6+1. -
Add type arguments to
CommandRunnerandCommandto indicate the return values of therun()functions.
-
-
0.13.630 Sep 2016Release notes
Open source →-
ArgParser.parse()now throws anArgParserException, which implementsFormatExceptionand has a field that lists the commands that were parsed. -
If
CommandRunner.run()encounters a parse error for a subcommand, it now prints the subcommand's usage rather than the global usage.
-
-
0.13.6+107 Nov 2016Release notes
Open source →- When a
CommandRunneris passed--helpbefore any commands, it now prints the usage of the chosen command.
- When a
-
0.13.522 Jul 2016Release notes
Open source →- Allow
CommandRunner.argParserandCommand.argParserto be overridden in strong mode.
- Allow
-
0.13.417 Mar 2016Release notes
Open source →-
By default, only the first line of a command's description is included in its parent runner's usage string. This returns to the default behavior from before 0.13.3+1.
-
A
Command.summarygetter has been added to explicitly control the summary that appears in the parent runner's usage string. This getter defaults to the first line of the description, but can be overridden if the user wants a multi-line summary.
-
-
0.13.4+105 May 2016 -
0.13.4+216 May 2016 -
0.13.3+120 Jan 2016 -
0.13.3+202 Feb 2016 -
0.13.3+308 Feb 2016Release notes
Open source →- Add an explicit default value for the
allowTrailingOptionsparameter tonew ArgParser(). This doesn't change the behavior at all; the option already defaulted tofalse, and passing innullstill works.
- Add an explicit default value for the
-
0.13.3+429 Feb 2016 -
0.13.3+605 Mar 2016 -
0.13.209 Jun 2015Release notes
Open source →- Allow option values that look like options. This more closely matches the
behavior of
getopt, the de facto standard for option parsing.
- Allow option values that look like options. This more closely matches the
behavior of
-
0.13.121 May 2015Release notes
Open source →- Add
ArgParser.addSeparator(). Separators allow users to group their options in the usage text.
- Add
-
0.13.005 Mar 2015Release notes
Open source →- Breaking change: An option that allows multiple values will now
automatically split apart comma-separated values. This can be controlled with
the
splitCommasoption.
- Breaking change: An option that allows multiple values will now
automatically split apart comma-separated values. This can be controlled with
the
-
0.12.217 Dec 2014Release notes
Open source →-
Add
CommandRunnerandCommandclasses which make it easy to build a command-based command-line application. -
Add an
ArgResults.argumentsfield, which contains the original argument list.
-
-
0.12.2+117 Dec 2014 -
0.12.2+214 Jan 2015Release notes
Open source →-
Updated dependency constraint on
unittest. -
Formatted source code.
-
Fixed use of deprecated API in example.
-
-
0.12.2+323 Jan 2015Release notes
Open source →- Fixed implementation of ArgResults.options to really use Iterable<String> instead of Iterable<dynamic> cast to Iterable<String>.
-
0.12.2+411 Feb 2015 -
0.12.2+517 Feb 2015 -
0.12.2+618 Feb 2015 -
0.12.131 Oct 2014Release notes
Open source →- Replace
ArgParser.getUsage()withArgParser.usage, a getter.ArgParser.getUsage()is now deprecated, to be removed in args version 1.0.0.
- Replace
-
0.12.017 Jul 2014Release notes
Open source →-
Removed public constructors for
ArgResultsandOption. -
ArgResults.wasParsed()can be used to determine if an option was actually parsed or the default value is being returned. -
Replaced
isFlagandallowMultiplefields in theOptionclass with a three-valueOptionTypeenum. -
Options may define
valueHelpwhich will then be shown in the usage.
-
-
0.12.0+124 Jul 2014Release notes
Open source →- Remove the documentation link from the pubspec so this is linked to pub.dev by default.
-
0.12.0+226 Aug 2014 -
0.11.006 May 2014Release notes
Open source →- Move handling trailing options from
ArgParser.parse()intoArgParseritself. This lets subcommands have different behavior for how they handle trailing options.
- Move handling trailing options from
-
0.11.0+112 May 2014Nothing published for this version
-
0.10.011 Dec 2013Nothing published for this version