Suggestion AutoCompleteCommand ( string input, string[] args, string commandName )
{
var suggestion = new Suggestion(input);
if (args.Length==1) {
suggestion = new Suggestion(args[0] + " ");
}
var cmd = GetCommand(commandName);
var parser = new CommandLineParser(cmd, commandName);
suggestion.Add( commandName + " " + string.Join(" ", parser.RequiredUsageHelp ) );
suggestion.Add( "" );
suggestion.Add( "options : " );
suggestion.AddRange( parser.OptionalUsageHelp.Select( opt => " " + opt ) );
return suggestion;
}