private void listScript(string languageName) { listScript( languageName, (l) => Console.WriteLine("Available scripts for {0}:", l.GetLanguage()), (d) => UsagePrinter.PrintDefinition(d)); }
private void printDefinitions(PrintType type) { var definitions = Bootstrapper.GetDefinitionBuilder() .Definitions .Where(x => x.Type == DefinitionCacheItemType.Script || x.Type == DefinitionCacheItemType.LanguageScript); if (type == PrintType.Simple) { Console.WriteLine("Available commands:"); UsagePrinter.PrintDefinitionsAligned(definitions); } else if (type == PrintType.Names) { UsagePrinter.PrintDefinitionNames(definitions); } else { Console.WriteLine("Available commands:"); foreach (var definition in definitions) { UsagePrinter.PrintDefinition(definition); } } }
private static void printUsage(string commandName) { var definitions = Bootstrapper.GetDefinitionBuilder().Definitions; if (commandName == null) { Console.WriteLine("OpenIDE v0.2"); Console.WriteLine("OpenIDE is a scriptable environment that provides simple IDE features around your favorite text exitor."); Console.WriteLine("(http://www.openide.net, http://github.com/ContinuousTests/OpenIDE)"); Console.WriteLine(); } if (commandName != null) { definitions = definitions .Where(x => x.Name.Contains(commandName) || ( x.Parameters.Any(y => y.Required && matchName(y.Name, commandName)) )); if (definitions.Count() > 0) { Console.WriteLine("Did you mean:"); } } if (definitions.Count() > 0 && commandName == null) { Console.WriteLine(); Console.WriteLine("\t[{0}=NAME] : Force command to run under specified profile", PROFILE); Console.WriteLine("\t[{0}=NAME] : Force command to run under specified global profile", GLOBAL_PROFILE); Console.WriteLine("\t[--default.language=NAME] : Force command to run using specified default language"); Console.WriteLine("\t[--enabled.languages=LANGUAGE_LIST] : Force command to run using specified languages"); Console.WriteLine("\t[--logging] : Enables logging to console"); Console.WriteLine("\t[--raw] : Prints raw output"); Console.WriteLine("\t[--skip-definition-rebuild] : Forces the system not to rebuild command definitions"); Console.WriteLine(); } definitions .OrderBy(x => x.Name) .ToList() .ForEach(x => UsagePrinter.PrintDefinition(x)); }
public void Execute(string[] arguments) { var definitions = Bootstrapper.GetDefinitionBuilder().Definitions; if (arguments.Length != 1) { UsagePrinter.PrintDefinitionsAligned( definitions .OrderBy(x => x.Name)); return; } var commandName = arguments[0]; var command = definitions.FirstOrDefault(x => x.Name == commandName); if (command == null) { Console.WriteLine("{0} is not a valid command", commandName); return; } UsagePrinter.PrintDefinition(command); Console.WriteLine(); }