Skip to content

Commit e6eac08

Browse files
committed
invoke additional arguments callback with any additional arguments found for the current parsed option
1 parent 0fcf5d0 commit e6eac08

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

FluentCommandLineParser/Internals/CommandLineOption.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ public void Bind(ParsedOption value)
155155
if (this.Parser.CanParse(value) == false) throw new OptionSyntaxException();
156156

157157
this.Bind(this.Parser.Parse(value));
158+
159+
this.BindAnyAdditionalArgs(value);
158160
}
159161

160162
/// <summary>
@@ -172,6 +174,16 @@ void Bind(T value)
172174
this.ReturnCallback(value);
173175
}
174176

177+
void BindAnyAdditionalArgs(ParsedOption option)
178+
{
179+
if (!this.HasAdditionalArgumentsCallback) return;
180+
181+
if (option.AdditionalValues.Any())
182+
{
183+
this.AdditionalArgumentsCallback(option.AdditionalValues);
184+
}
185+
}
186+
175187
/// <summary>
176188
/// Adds the specified description to the <see cref="ICommandLineOptionFluent{T}"/>.
177189
/// </summary>

0 commit comments

Comments
 (0)