Skip to content

Commit 93db30b

Browse files
committed
allow `,`
1 parent 4dfb120 commit 93db30b

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

ReadMe.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,19 +224,23 @@ Foo(int[] array)
224224
> SampleApp.exe -array 9999
225225
```
226226

227-
multiple-argument can handle by split with ` `.
227+
multiple-argument can handle by split with ` ` or `,`.
228228

229229
```csharp
230230
Foo(int[] array)
231231
> SampleApp.exe -array "11 22 33"
232+
> SampleApp.exe -array "11,22,33"
233+
> SampleApp.exe -array "[11,22,33]"
232234
```
233235

234236
string argument can handle without `"`.
235237

236238
```csharp
237239
Foo(string[] array)
238-
> SampleApp.exe -array "hello"
240+
> SampleApp.exe -array hello
239241
> SampleApp.exe -array "foo bar baz"
242+
> SampleApp.exe -array foo,bar,baz
243+
> SampleApp.exe -array "["foo","bar","baz"]"
240244
```
241245

242246
Exit Code

sandbox/SingleContainedApp/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void Help()
115115

116116
public class ComplexArgTest : BatchBase
117117
{
118-
public void Foo(string[] array, Person person)
118+
public void Foo(int[] array, Person person)
119119
{
120120
Console.WriteLine(array.Length + ":" + string.Join(", ", array));
121121
Console.WriteLine(person.Age + ":" + person.Name);
@@ -132,7 +132,7 @@ class Program
132132
{
133133
static async Task Main(string[] args)
134134
{
135-
args = new[] { "-array", "foo bar baz", "-person", @"{""Age"":10,""Name"":""foo""}" };
135+
args = new[] { "-array", "10,20,30", "-person", @"{""Age"":10,""Name"":""foo""}" };
136136

137137
await BatchHost.CreateDefaultBuilder()
138138
.ConfigureServices((hostContext, services) =>

src/MicroBatchFramework/BatchEngine.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ static bool TryGetInvokeArguments(ParameterInfo[] parameters, string?[] args, in
254254
{
255255
if (!(v.StartsWith("\"") && v.EndsWith("\"")))
256256
{
257-
v = "[" + string.Join(",", v.Split(' ').Select(x => "\"" + x + "\"")) + "]";
257+
v = "[" + string.Join(",", v.Split(' ', ',').Select(x => "\"" + x + "\"")) + "]";
258258
}
259259
else
260260
{
@@ -263,7 +263,7 @@ static bool TryGetInvokeArguments(ParameterInfo[] parameters, string?[] args, in
263263
}
264264
else
265265
{
266-
v = "[" + string.Join(",", v.Trim('\'', '\"').Split(' ')) + "]";
266+
v = "[" + string.Join(",", v.Trim('\'', '\"').Split(' ', ',')) + "]";
267267
}
268268
}
269269
try

0 commit comments

Comments
 (0)