Skip to content
This repository was archived by the owner on Oct 17, 2024. It is now read-only.

Commit 16dc018

Browse files
committed
Merge branch 'main' into add-source-2
Signed-off-by: ふぁ <[email protected]>
2 parents d1c1481 + 09c0fca commit 16dc018

File tree

6 files changed

+14
-10
lines changed

6 files changed

+14
-10
lines changed

.github/workflows/test-package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
matrix:
2222
sdk: [dev]
2323
steps:
24-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
24+
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
2525
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
2626
with:
2727
sdk: ${{ matrix.sdk }}
@@ -47,7 +47,7 @@ jobs:
4747
os: [ubuntu-latest]
4848
sdk: ['3.3', dev]
4949
steps:
50-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
50+
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
5151
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
5252
with:
5353
sdk: ${{ matrix.sdk }}

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 2.5.1-wip
1+
## 2.6.0-wip
22

33
* Added source argument when throwing a `ArgParserException`.
44
* Fix inconsistent `FormatException` messages

lib/src/arg_parser_exception.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@ class ArgParserException extends FormatException {
99
/// This will be empty if the error was on the root parser.
1010
final List<String> commands;
1111

12-
/// The argument that were being parsed when the error was discovered.
13-
final String? arg;
12+
/// The name of the argument that was being parsed when the error was
13+
/// discovered.
14+
final String? argumentName;
1415

1516
ArgParserException(super.message,
16-
[Iterable<String>? commands, this.arg, super.source, super.offset])
17+
[Iterable<String>? commands,
18+
this.argumentName,
19+
super.source,
20+
super.offset])
1721
: commands = commands == null ? const [] : List.unmodifiable(commands);
1822

1923
/// Returns a string representation of this exception.

lib/src/parser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class Parser {
115115
throw ArgParserException(
116116
error.message,
117117
[commandName, ...error.commands],
118-
error.arg,
118+
error.argumentName,
119119
error.source,
120120
error.offset);
121121
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: args
2-
version: 2.5.1-wip
2+
version: 2.6.0-wip
33
description: >-
44
Library for defining parsers for parsing raw command-line arguments into a set
55
of options and values using GNU and POSIX style options.

test/test_utils.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,14 +349,14 @@ void throwsFormat(ArgParser parser, List<String> args, {String? reason}) {
349349
}
350350

351351
void throwsArgParserException(ArgParser parser, List<String> args,
352-
String message, List<String> commands, String arg, int offset) {
352+
String message, List<String> commands, String argumentName, int offset) {
353353
try {
354354
parser.parse(args);
355355
fail('Expected an ArgParserException');
356356
} on ArgParserException catch (e) {
357357
expect(e.message, message);
358358
expect(e.commands, commands);
359-
expect(e.arg, arg);
359+
expect(e.argumentName, argumentName);
360360
expect(e.source, args);
361361
expect(e.offset, offset);
362362
} catch (e) {

0 commit comments

Comments
 (0)