Skip to content

Commit

Permalink
Command line parsing changes
Browse files Browse the repository at this point in the history
  • Loading branch information
robot9706 committed Sep 13, 2017
1 parent a526363 commit 06ae922
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
15 changes: 4 additions & 11 deletions Source/Mosa.Tool.GDBDebugger/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -416,19 +416,12 @@ public void OnRemoveWatch(Object sender, EventArgs e)

public void LoadArguments(string[] args)
{
Options = ParseOptions(args);
}

private static Options ParseOptions(string[] args)
{
ParserResult<Options> result = new Parser(config => config.HelpWriter = Console.Out).ParseArguments<Options>(args);
Parser cliParser = new Parser(config => config.HelpWriter = Console.Out);

if (result.Tag == ParserResultType.NotParsed)
cliParser.ParseArguments<Options>(() =>
{
return new Options();
}

return ((Parsed<Options>)result).Value;
return Options;
}, args);
}
}
}
15 changes: 4 additions & 11 deletions Source/Mosa.Tool.Launcher/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -521,19 +521,12 @@ private void benRemoveFiles_Click(object sender, EventArgs e)

public void LoadArguments(string[] args)
{
Options = ParseOptions(args);
}

private static Options ParseOptions(string[] args)
{
ParserResult<Options> result = new Parser(config => config.HelpWriter = Console.Out).ParseArguments<Options>(args);
Parser cliParser = new Parser(config => config.HelpWriter = Console.Out);

if (result.Tag == ParserResultType.NotParsed)
cliParser.ParseArguments<Options>(() =>
{
return new Options();
}

return ((Parsed<Options>)result).Value;
return Options;
}, args);
}
}
}

0 comments on commit 06ae922

Please sign in to comment.