Skip to content

Commit d43ee61

Browse files
committed
Improve help text output, refactor interpreter
1 parent 633c1cc commit d43ee61

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/InEngine/ArgumentInterpreter.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,15 @@ protected string MakeErrorMessage(string message = null)
106106
return $"✘ {message}";
107107
}
108108

109-
public void InterpretPluginArguments(string[] pluginArgs, AbstractPlugin pluginOptions)
109+
public void InterpretPluginArguments(string[] pluginArgs, AbstractPlugin abstractPlugin)
110110
{
111-
var isSuccessful = Parser.Default.ParseArguments(pluginArgs, pluginOptions, (verb, subOptions) => {
111+
var isSuccessful = Parser.Default.ParseArguments(pluginArgs, abstractPlugin, (verb, subOptions) => {
112112
try
113-
{
114-
var lastArg = pluginArgs.ToList().LastOrDefault();
115-
if (subOptions == null && (lastArg == "-h" || lastArg == "--help"))
113+
{
114+
if (subOptions == null && (pluginArgs.Contains("-h") || pluginArgs.Contains("--help")))
116115
ExitWithSuccess();
117116
else if (subOptions == null)
118-
ExitWithFailure(new CommandFailedException("Could not parse plugin arguments. Use -h, --help for usage."));
117+
ExitWithFailure("");
119118
var command = subOptions as AbstractCommand;
120119
if (command is AbstractCommand)
121120
(command as AbstractCommand).Name = verb.Normalize();

0 commit comments

Comments
 (0)