0%

Simple Parse Command Line

T1.Standard.Extensions

Simple Parse Command Line Sample

1
2
3
4
5
6
7
8
9
10
11
12
var commandLine = @"1 2";

var args = commandLine
.ParseCommandArgsLine()
.ToArray();

var expected = new[]
{
"1",
"2"
};
expected.ToExpectedObject().ShouldEqual(args);

It can parse quote string command line

1
2
3
4
5
6
7
8
9
10
11
12
var commandLine = @"1 '2 3'";

var args = commandLine
.ParseCommandArgsLine()
.ToArray();

var expected = new[]
{
"1",
"'2 3'"
};
expected.ToExpectedObject().ShouldEqual(args);