Skip to content

Commit 6c5a04a

Browse files
committed
Fix parsing arguments
1 parent 0044124 commit 6c5a04a

File tree

6 files changed

+1383
-224
lines changed

6 files changed

+1383
-224
lines changed

ClientLibNetCore/ClientLibNetCore.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
<ItemGroup>
88
<PackageReference Include="amqpnetlite" Version="2.0.0" />
9-
<PackageReference Include="CommandLineParser" Version="2.1.1-beta" />
109
</ItemGroup>
1110

1211
</Project>

ClientLibNetCore/CoreClient.cs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,23 @@ public CoreClient()
5353
/// <returns>options</returns>
5454
protected void ParseArguments(string[] args, Options typeArguments)
5555
{
56-
//try {
57-
// var unrecognized = typeArguments.Parse(args);
58-
// if (unrecognized.Count > 0)
59-
// {
60-
// typeArguments.PrintHelp();
61-
// foreach (var item in unrecognized)
62-
// Console.WriteLine("ERROR: {{ 'cause': {0}}}", item);
63-
// Environment.Exit(ReturnCode.ERROR_ARG);
64-
// }
65-
//}
66-
//catch
67-
//{
68-
// typeArguments.PrintHelp();
69-
// Environment.Exit(ReturnCode.ERROR_ARG);
70-
//}
71-
//this.SetUpCliLogging(typeArguments);
56+
try
57+
{
58+
var unrecognized = typeArguments.Parse(args);
59+
if (unrecognized.Count > 0)
60+
{
61+
typeArguments.PrintHelp();
62+
foreach (var item in unrecognized)
63+
Console.WriteLine("ERROR: {{ 'cause': {0}}}", item);
64+
Environment.Exit(ReturnCode.ERROR_ARG);
65+
}
66+
}
67+
catch
68+
{
69+
typeArguments.PrintHelp();
70+
Environment.Exit(ReturnCode.ERROR_ARG);
71+
}
72+
this.SetUpCliLogging(typeArguments);
7273
}
7374

7475
/// <summary>
@@ -172,7 +173,7 @@ protected void CloseConnection()
172173
protected void ArgumentExceptionHandler(Exception ex, Options options)
173174
{
174175
Console.Error.WriteLine("Invalid command option: " + ex.Message);
175-
options.PrintHelp();
176+
//options.PrintHelp();
176177
this.exitCode = ReturnCode.ERROR_ARG;
177178
}
178179

0 commit comments

Comments
 (0)