예제 #1
0
        /// <summary>
        /// Writes out the help details from the console.
        /// </summary>
        /// <param name="command"> The command being executed.</param>
        /// <param name="overview"> A brief description of what the command accomplishes.</param>
        /// <param name="arguements"> The dictionary being used to show help commands.</param>
        public static void WriteHelpDetail(string command, string overview, Dictionary <string, string> arguements)
        {
            // Display the command and overview.
            Console.WriteLine("Command name: " + command);
            Console.WriteLine("Overview: " + overview);

            // Make sure their is a dictionary.
            if (arguements != null)
            {
                // Put the keys in a list.
                List <string> list = new List <string>(arguements.Keys);

                // Give flatten the arguments passed in from the console to display for the user.
                string result = ListUtil.Flatten(list, " ");

                // Display the flatten results.
                Console.WriteLine("Usage: " + command + " " + result);

                // Write out the word parameters.
                Console.WriteLine("Parameters:");

                // For each Key - value PAIR in arguements.
                foreach (KeyValuePair <string, string> kvp in arguements)
                {
                    // Trying to match display.
                    Console.WriteLine(kvp.Key + " " + kvp.Value);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Write help details.
        /// </summary>
        /// <param name="command">The command passed in.</param>
        /// <param name="overview">The details of the command.</param>
        /// <param name="arguments">The arguments from the dictionary.</param>
        public static void WriteHelpDetail(string command, string overview, Dictionary <string, string> arguments)
        {
            // Displays the command.
            Console.WriteLine($"Command Name: {command}");

            // Displays the description of the command.
            Console.WriteLine($"Overview: {overview}");

            // Get the keys of the arguments dictionary.
            string argumentsKeys = ListUtil.Flatten(arguments.Keys, " ");

            // Display the usage of the command.
            Console.Write($"Usage: {command} {argumentsKeys}");

            Console.WriteLine("\n" + "Parameters: ");

            foreach (KeyValuePair <string, string> kvp in arguments)
            {
                Console.WriteLine($"{kvp.Key}: {kvp.Value}");
            }
        }