예제 #1
0
        /// <summary>
        /// Prints help to formatter
        /// </summary>
        /// <param name="configuration">Full configuration</param>
        /// <param name="command">Specific command to output</param>
        /// <param name="operationMessages">List of operation message</param>
        public override sealed void PrintHelp(Configuration configuration, Command command, Operation.Items operationMessages)
        {
            // Write errors
            var errors = operationMessages.Where(i => i.Type == Operation.ItemType.Error);

            if (errors.Any())
            {
                foreach (var e in errors)
                {
                    WriteLine(e.Message, System.ConsoleColor.Red);
                }
                WriteLine();
            }

            // Write program name
            if (!String.IsNullOrEmpty(configuration.Program.Name))
            {
                WriteLine($"{configuration.Program.Name} ({System.Reflection.Assembly.GetEntryAssembly().GetName().Version})");
                if (!String.IsNullOrEmpty(configuration.Program.Description))
                {
                    WriteLine(configuration.Program.Description);
                }
                if (!String.IsNullOrEmpty(configuration.Program.HelpUrl))
                {
                    WriteLine(configuration.Program.HelpUrl);
                }
                WriteLine();
            }

            // Single command, or multiple command
            if (command != null)
            {
                PrintHelpCommand(configuration, command);
            }
            else
            {
                PrintHelpConfiguration(configuration);
            }
        }
예제 #2
0
 /// <summary>
 /// Prints help to formatter
 /// </summary>
 /// <param name="configuration">Full configuration</param>
 /// <param name="command">Specific command to output</param>
 /// <param name="operationMessages">List of operation message</param>
 public abstract void PrintHelp(Configuration configuration, Command command, Operation.Items operationMessages);