public void Tokenise_EscapeQuotedArg() { string[] args = new string[] { "--hello", @"w\orld" }; List <Token> expectedTokens = new List <Token>() { new Token("--hello", true), new Token(@"w\orld", false) }; var tokens = Tokeniser.MakeTokens(args); Assert.Equal(expectedTokens, tokens, new TokenEqualityComparer()); }
public void Tokenise_EqualsSign() { string[] args = new string[] { "--goodbye=bob" }; List <Token> expectedTokens = new List <Token>() { new Token("--goodbye", true), new Token("bob", false) }; var tokens = Tokeniser.MakeTokens(args); Assert.Equal(expectedTokens, tokens, new TokenEqualityComparer()); }
public void Tokenise_Singles() { string[] args = new string[] { "-abc" }; List <Token> expectedTokens = new List <Token>() { new Token("-a", true), new Token("-b", true), new Token("-c", true) }; var tokens = Tokeniser.MakeTokens(args); Assert.Equal(expectedTokens, tokens, new TokenEqualityComparer()); }
private static ArgumentModel ParseArguments <A>(A arguments, string[] args) where A : BaseCliArguments { // Process inputs ArgumentModel model = new ArgumentModel(arguments); var tokens = Tokeniser.MakeTokens(args); ParseResult parseResult = Parser.MakeParseResult(tokens, model); // Map results model = ArgumentMapper.MapOptions(model, parseResult); if (model.CliArguments.HelpInvoked) { model.HelpFacade.Execute(); } return(model); }