private static void Help() { int totalCommandCount = CommandConsole.Current.CommandRegistry.AllRegisteredCommands.GetCommandCount(); if (totalCommandCount == 0) { LConsole.WriteLine("Uh oh, there aren't any registered commands"); return; } int maxUsageLength = GetMaxCommandUsageLength(CommandConsole.Current.CommandRegistry.AllRegisteredCommands.EnumerateAllCommands()); LineWriter writer = LConsole.BeginLine(); writer.WriteLine($"Available commands ({totalCommandCount}):", ConsoleColor.Magenta); writer.WriteLine(); foreach (string assemblyName in CommandConsole.Current.CommandRegistry.CommandsByAssembly.Keys.OrderBy(s => s)) { WriteAssemblyCommands(maxUsageLength, writer, assemblyName); writer.WriteLine(); } writer.End(); }
private static void HelpAss(string assemblyName) { if (!CommandConsole.Current.CommandRegistry.CommandsByAssembly.TryGetValue(assemblyName, out var commands)) { LConsole.WriteLine($"No assembly with commands found by name {assemblyName}. See `help` for commands in all assemblies."); return; } int maxUsageLength = GetMaxCommandUsageLength(commands); LineWriter writer = LConsole.BeginLine(); WriteAssemblyCommands(maxUsageLength, writer, assemblyName); writer.End(); }
private static void PrintEnvironment() { if (!CommandConsole.Current.Config.EnableVariables) { LConsole.WriteLine("Variables are disabled", ConsoleColor.Red); return; } foreach (var item in CommandConsole.Current.Shell.Environment.GetAll()) { LConsole.BeginLine() .Write(item.Key, ConsoleColor.DarkGreen) .Write(" = ", ConsoleColor.DarkGray) .Write(item.Value) .End(); } }