Exemplo n.º 1
0
        public void CanLoadMultipleCommands()
        {
            var commands = new CommandLoader().LoadCommandsFrom(this);

            Assert.True(commands["hello"] != null);
            Assert.True(commands["goodbye"] != null);
        }
Exemplo n.º 2
0
        public override async Task <IGenesisExecutionResult> Execute(GenesisContext genesis, string[] args)
        {
            await CommandLoader.InitAsync(args);

            Text.Line();
            Text.Cyan("Genesis"); Text.GrayLine($" {Program.GetVersionDisplayString()}");
            Text.Line();

            foreach (var cmd in CommandLoader.Commands)
            {
                if (cmd.Name == string.Empty) //default command leaves an empty line otherwise
                {
                    continue;
                }

                Text.Green($"\t{cmd.Name}"); Text.WhiteLine($"\t{cmd.Description}");
            }

            Text.Line();

            return(await Task.FromResult(new BlankGenesisExecutionResult()
            {
                Success = true, Message = ""
            }));
        }
Exemplo n.º 3
0
    private void Init()
    {
        commandsUtils = new CommandsUtils();
        List <ICommand> loaderList = CommandLoader.Load();

        commandsUtils.RegCommands(loaderList);
    }
Exemplo n.º 4
0
        private static void WriteHelp(
            string commandName,
            bool online,
            bool manual,
            bool includeValues,
            Filter filter = null)
        {
            if (online)
            {
                OpenHelpInBrowser(commandName);
            }
            else if (commandName != null)
            {
                Command command = CommandLoader.LoadCommand(typeof(HelpCommand).Assembly, commandName);

                if (command == null)
                {
                    throw new InvalidOperationException($"Command '{commandName}' does not exist.");
                }

                WriteCommandHelp(command, includeValues: includeValues, filter: filter);
            }
            else if (manual)
            {
                WriteManual(includeValues: includeValues, filter: filter);
            }
            else
            {
                WriteCommandsHelp(includeValues: includeValues, filter: filter);
            }
        }
        internal static MapContextCommand ShowMapContextMenu(Control parent, Point location, MapContextCommand[] hideCommands, CommandManager commandManager)
        {
            Command returnCommand;

            using (CommandLoader commandLoader = new CommandLoader(commandManager, FilterMapContextMenuCommands(hideCommands)))
            {
                CommandContextMenuDefinition ccmd = new CommandContextMenuDefinition();
                ccmd.CommandBar = false;
                ccmd.Entries.Add(CommandId.MapAddPushpin, false, true);
                ccmd.Entries.Add(CommandId.MapZoomStreetLevel, false, false);
                ccmd.Entries.Add(CommandId.MapZoomCityLevel, false, false);
                ccmd.Entries.Add(CommandId.MapZoomRegionLevel, false, false);
                ccmd.Entries.Add(CommandId.MapCenterMap, false, false);

                returnCommand = CommandContextMenu.ShowModal(
                    commandManager, parent, location, ccmd);
            }

            if (returnCommand != null)
            {
                return((MapContextCommand)_mapCommandIds[Enum.Parse(typeof(CommandId), returnCommand.Identifier)]);
            }
            else
            {
                return(MapContextCommand.None);
            }
        }
Exemplo n.º 6
0
        public override void Action(CommandCaller caller, string input, string[] args)
        {
            if (args.Length > 0)
            {
                if (!CommandLoader.GetCommand(caller, args[0], out ModCommand mc))
                {
                    throw new UsageException("Unknown command: " + args[0], Color.Red);
                }
                if (mc != null)
                {
                    caller.Reply(mc.Usage);
                    if (!string.IsNullOrEmpty(mc.Description))
                    {
                        caller.Reply(mc.Description);
                    }
                }
                return;
            }

            var help = CommandLoader.GetHelp(caller.CommandType);

            caller.Reply(caller.CommandType + " Commands:", Color.Yellow);

            foreach (var entry in help)
            {
                caller.Reply(entry.Item1 + "   " + entry.Item2);
            }

            if (Main.netMode == 1)
            {
                //send the command to the server
                ChatHelper.SendChatMessageFromClient(new ChatMessage(input));
            }
        }
Exemplo n.º 7
0
        private static void Main(string[] args)
        {
            var bot = new BotBitsClient();

            // Events
            EventLoader
            .Of(bot)
            .LoadStatic <Program>();

            // Commands
            CommandsExtension.LoadInto(bot, '!', '.');
            CommandLoader
            .Of(bot)
            .LoadStatic <Program>();

            // Login
            Login.Of(bot)
            .AsGuest()
            .CreateJoinRoom("PW01");

            // Console commands
            while (true)
            {
                CommandManager.Of(bot).ReadNextConsoleCommand();
            }
        }
Exemplo n.º 8
0
        private SessionHandler GetSessionHandler()
        {
            var path          = Environment.CurrentDirectory;
            var commandLoader = new CommandLoader(new PluginsPath(path + "\\..\\..\\..\\bin\\Debug\\Plugins"),
                                                  new MockEventStorage(), new MockPersonsStorage());

            return(new SessionHandler(commandLoader));
        }
Exemplo n.º 9
0
        public void CanRunHelloCommand()
        {
            using (StringWriter sw = new StringWriter())
            {
                Console.SetOut(sw);

                var commands = new CommandLoader().LoadCommandsFrom(this);
                commands["hello"].Invoke(null);

                Assert.Equal("Output from hello command!", sw.ToString());
            }
        }
Exemplo n.º 10
0
        public Commands()
        {
            InitializeFinish += (sender, e) =>
            {
                roundsManager = RoundsManager.Of(BotBits);

                if (!CommandsExtension.IsLoadedInto(BotBits))
                {
                    return;
                }

                CommandLoader.Of(BotBits).Load(this);

                requireModerator = PermissionsExtension.IsLoadedInto(BotBits);
            };
        }
Exemplo n.º 11
0
        public override async Task <ITaskResult> Execute(GenesisContext genesis, string[] args)
        {
            await CommandLoader.InitAsync(args);

            Text.Line();
            Text.Cyan("Genesis"); Text.GrayLine($" {Program.GetVersionDisplayString()}");
            Text.Line();

            foreach (var cmd in CommandLoader.Commands)
            {
                Text.Green($"\t{cmd.Name}"); Text.WhiteLine($"\t{cmd.Description}");
            }
            return(await Task.FromResult(new BlankTaskResult()
            {
                Success = true, Message = ""
            }));
        }
Exemplo n.º 12
0
        internal static PushpinContextCommand ShowPushpinContextMenu(Control parent, Point location, CommandManager commandManager)
        {
            Command command;

            using (CommandLoader commandLoader = new CommandLoader(commandManager, PushpinContextMenuIds))
            {
                CommandContextMenuDefinition ccmd = new CommandContextMenuDefinition();
                ccmd.CommandBar = false;
                ccmd.Entries.Add(CommandId.MapEditPushpin, false, false);
                ccmd.Entries.Add(CommandId.MapDeletePushpin, false, false);

                command = CommandContextMenu.ShowModal(
                    commandManager, parent, location, ccmd);
            }

            if (command != null)
            {
                return((PushpinContextCommand)_pushpinCommandIds[Enum.Parse(typeof(CommandId), command.Identifier)]);
            }
            else
            {
                return(PushpinContextCommand.None);
            }
        }
Exemplo n.º 13
0
        private static void Main(params string[] args)
        {
            IEnumerable <Command> commands = CommandLoader.LoadCommands(typeof(CommandLoader).Assembly)
                                             .Select(c => c.WithOptions(c.Options.OrderBy(f => f, CommandOptionComparer.Instance)))
                                             .OrderBy(c => c.Name, StringComparer.InvariantCulture);

            var application = new CommandLineApplication(
                "orang",
                "Search, replace, rename and delete files and its content using the power of .NET regular expressions.",
                commands.OrderBy(f => f.Name, StringComparer.InvariantCulture));

            string destinationDirectoryPath = null;
            string dataDirectoryPath        = null;

            if (Debugger.IsAttached)
            {
                destinationDirectoryPath = (args.Length > 0) ? args[0] : @"..\..\..\..\..\docs\cli";
                dataDirectoryPath        = @"..\..\..\data";
            }
            else
            {
                destinationDirectoryPath = args[0];
                dataDirectoryPath        = @"..\src\DocumentationGenerator\data";
            }

            string readmeFilePath = Path.GetFullPath(Path.Combine(destinationDirectoryPath, "README.md"));

            using (var sw = new StreamWriter(readmeFilePath, append: false, Encoding.UTF8))
                using (MarkdownWriter mw = MarkdownWriter.Create(sw))
                {
                    mw.WriteHeading1("Orang Command-Line Interface");
                    mw.WriteString(application.Description);
                    mw.WriteLine();

                    mw.WriteHeading2("Commands");

                    foreach (Command command in application.Commands)
                    {
                        mw.WriteStartBulletItem();
                        mw.WriteLink(command.Name, command.Name + "-command.md");
                        mw.WriteEndBulletItem();
                    }

                    mw.WriteLine();

                    string readmeLinksFilePath = Path.Combine(dataDirectoryPath, "readme_bottom.md");

                    if (File.Exists(readmeLinksFilePath))
                    {
                        mw.WriteRaw(File.ReadAllText(readmeLinksFilePath));
                    }

                    WriteFootNote(mw);

                    Console.WriteLine(readmeFilePath);
                }

            string valuesFilePath = Path.GetFullPath(Path.Combine(destinationDirectoryPath, "AllowedValues.md"));

            ImmutableArray <OptionValueProvider> providers = HelpProvider.GetProviders(commands).ToImmutableArray();

            MDocument document = Document(
                Heading1("List of Allowed Values"),
                BulletList(providers.Select(f => Link(f.Name, "#" + f.Name
                                                      .ToLower()
                                                      .Replace("<", "")
                                                      .Replace(">", "")
                                                      .Replace("_", "-")))),
                providers.Select(provider =>
            {
                return(new MObject[]
                {
                    Heading2(provider.Name),
                    Table(
                        TableRow("Value", "Description"),
                        provider.Values.Select(f => TableRow(f.HelpValue, f.Description)))
                });
            }));

            var markdownFormat = new MarkdownFormat(tableOptions: MarkdownFormat.Default.TableOptions | TableOptions.FormatContent);

            File.WriteAllText(valuesFilePath, document.ToString(markdownFormat));

            foreach (Command command in application.Commands)
            {
                readmeFilePath = Path.GetFullPath(Path.Combine(destinationDirectoryPath, $"{command.Name}-command.md"));

                using (var sw = new StreamWriter(readmeFilePath, append: false, Encoding.UTF8))
                    using (MarkdownWriter mw = MarkdownWriter.Create(sw))
                    {
                        var writer = new DocumentationWriter(mw);

                        writer.WriteCommandHeading(command, application);
                        writer.WriteCommandDescription(command);
                        writer.WriteCommandSynopsis(command, application);
                        writer.WriteArguments(command.Arguments);
                        writer.WriteOptions(command.Options);

                        string samplesFilePath = Path.Combine(dataDirectoryPath, command.Name + "_bottom.md");

                        if (File.Exists(samplesFilePath))
                        {
                            string content = File.ReadAllText(samplesFilePath);
                            mw.WriteRaw(content);
                        }

                        WriteFootNote(mw);

                        Console.WriteLine(readmeFilePath);
                    }
            }

            Console.WriteLine("Done");

            if (Debugger.IsAttached)
            {
                Console.ReadKey();
            }
        }
Exemplo n.º 14
0
        private static void Main(params string[] args)
        {
            IEnumerable <Command> commands = CommandLoader.LoadCommands(typeof(CommandLoader).Assembly)
                                             .Select(c => c.WithOptions(c.Options.OrderBy(f => f, CommandOptionComparer.Name)))
                                             .OrderBy(c => c.Name, StringComparer.InvariantCulture);

            var application = new CommandLineApplication(
                "roslynator",
                "Roslynator Command-line Tool",
                commands.OrderBy(f => f.Name, StringComparer.InvariantCulture));

            string destinationDirectoryPath = null;
            string dataDirectoryPath        = null;

            if (Debugger.IsAttached)
            {
                destinationDirectoryPath = (args.Length > 0) ? args[0] : @"..\..\..\..\..\docs\cli";
                dataDirectoryPath        = @"..\..\..\data";
            }
            else
            {
                destinationDirectoryPath = args[0];
                dataDirectoryPath        = @"..\src\CommandLine.DocumentationGenerator\data";
            }

            foreach (Command command in application.Commands)
            {
                string commandFilePath = Path.GetFullPath(Path.Combine(destinationDirectoryPath, $"{command.Name}-command.md"));

                using (var sw = new StreamWriter(commandFilePath, append: false, Encoding.UTF8))
                    using (MarkdownWriter mw = MarkdownWriter.Create(sw))
                    {
                        var writer = new DocumentationWriter(mw);

                        mw.WriteLine();
                        writer.WriteCommandHeading(command, application);
                        writer.WriteCommandDescription(command);

                        mw.WriteLink("Home", "README.md");

                        string additionalContentFilePath = Path.Combine(dataDirectoryPath, command.Name + "_bottom.md");

                        string additionalContent = (File.Exists(additionalContentFilePath))
                        ? File.ReadAllText(additionalContentFilePath)
                        : "";

                        var sections = new List <string>()
                        {
                            "Synopsis", "Arguments", "Options"
                        };

                        if (Regex.IsMatch(additionalContent, @"^\#+ Examples", RegexOptions.Multiline))
                        {
                            sections.Add("Examples");
                        }

                        foreach (string section in sections)
                        {
                            mw.WriteString(" ");
                            mw.WriteCharEntity((char)0x2022);
                            mw.WriteString(" ");
                            mw.WriteLink(section, "#" + section);
                        }

                        mw.WriteLine();

                        writer.WriteCommandSynopsis(command, application);
                        writer.WriteArguments(command.Arguments);
                        writer.WriteOptions(command.Options);

                        if (!string.IsNullOrEmpty(additionalContent))
                        {
                            mw.WriteLine();
                            mw.WriteLine();
                            mw.WriteRaw(additionalContent);
                        }

                        WriteFootNote(mw);

                        Console.WriteLine(commandFilePath);
                    }
            }

            Console.WriteLine("Done");

            if (Debugger.IsAttached)
            {
                Console.ReadKey();
            }
        }
Exemplo n.º 15
0
 public ConsoleHandler(CommandLoader commands)
 {
     _commands = commands;
 }
Exemplo n.º 16
0
        private static int Main(string[] args)
        {
#if DEBUG
            if (args.LastOrDefault() == "--debug")
            {
                WriteArgs(args.Take(args.Length - 1).ToArray(), Verbosity.Quiet);
                return(ExitCodes.NotSuccess);
            }
#endif
            Parser parser = null;
            try
            {
                parser = CreateParser(ignoreUnknownArguments: true);

                if (args == null ||
                    args.Length == 0)
                {
                    HelpCommand.WriteCommandsHelp();
                    return(ExitCodes.Success);
                }

                bool?success = null;

                ParserResult <BaseCommandLineOptions> defaultResult = parser
                                                                      .ParseArguments <BaseCommandLineOptions>(args)
                                                                      .WithParsed(options =>
                {
                    if (!options.Help)
                    {
                        return;
                    }

                    string commandName = args?.FirstOrDefault();
                    Command command    = (commandName != null)
                            ? CommandLoader.LoadCommand(typeof(Program).Assembly, commandName)
                            : null;

                    if (!ParseVerbosityAndOutput(options))
                    {
                        success = false;
                        return;
                    }

                    WriteArgs(args, Verbosity.Diagnostic);

                    if (command != null)
                    {
                        HelpCommand.WriteCommandHelp(command);
                    }
                    else
                    {
                        HelpCommand.WriteCommandsHelp();
                    }

                    success = true;
                });

                if (success == false)
                {
                    return(ExitCodes.Error);
                }

                if (success == true)
                {
                    return(ExitCodes.Success);
                }

                parser = CreateParser();

                ParserResult <object> parserResult = parser.ParseArguments(
                    args,
                    new Type[]
                {
                    typeof(AnalyzeCommandLineOptions),
                    typeof(FixCommandLineOptions),
                    typeof(FormatCommandLineOptions),
                    typeof(GenerateDocCommandLineOptions),
                    typeof(GenerateDocRootCommandLineOptions),
                    typeof(HelpCommandLineOptions),
                    typeof(ListSymbolsCommandLineOptions),
                    typeof(LogicalLinesOfCodeCommandLineOptions),
                    typeof(MigrateCommandLineOptions),
                    typeof(PhysicalLinesOfCodeCommandLineOptions),
                    typeof(RenameSymbolCommandLineOptions),
                    typeof(SpellcheckCommandLineOptions),
#if DEBUG
                    typeof(AnalyzeAssemblyCommandLineOptions),
                    typeof(FindSymbolsCommandLineOptions),
                    typeof(GenerateSourceReferencesCommandLineOptions),
                    typeof(ListVisualStudioCommandLineOptions),
                    typeof(ListReferencesCommandLineOptions),
                    typeof(SlnListCommandLineOptions),
#endif
                });

                parserResult.WithNotParsed(e =>
                {
                    if (e.Any(f => f.Tag == ErrorType.VersionRequestedError))
                    {
                        Console.WriteLine(typeof(Program).GetTypeInfo().Assembly.GetName().Version);
                        success = false;
                        return;
                    }

                    var helpText = new HelpText(SentenceBuilder.Create(), HelpCommand.GetHeadingText());

                    helpText = HelpText.DefaultParsingErrorsHandler(parserResult, helpText);

                    VerbAttribute verbAttribute = parserResult.TypeInfo.Current.GetCustomAttribute <VerbAttribute>();

                    if (verbAttribute != null)
                    {
                        helpText.AddPreOptionsText(Environment.NewLine + HelpCommand.GetFooterText(verbAttribute.Name));
                    }

                    Console.Error.WriteLine(helpText);

                    success = false;
                });

                if (success == true)
                {
                    return(ExitCodes.Success);
                }

                if (success == false)
                {
                    return(ExitCodes.Error);
                }

                parserResult.WithParsed <AbstractCommandLineOptions>(
                    options =>
                {
                    if (ParseVerbosityAndOutput(options))
                    {
                        WriteArgs(args, Verbosity.Diagnostic);
                    }
                    else
                    {
                        success = false;
                    }
                });

                if (success == false)
                {
                    return(ExitCodes.Error);
                }

                return(parserResult.MapResult(
                           (MSBuildCommandLineOptions options) =>
                {
                    switch (options)
                    {
                    case AnalyzeCommandLineOptions analyzeCommandLineOptions:
                        return AnalyzeAsync(analyzeCommandLineOptions).Result;

                    case FixCommandLineOptions fixCommandLineOptions:
                        return FixAsync(fixCommandLineOptions).Result;

                    case FormatCommandLineOptions formatCommandLineOptions:
                        return FormatAsync(formatCommandLineOptions).Result;

                    case GenerateDocCommandLineOptions generateDocCommandLineOptions:
                        return GenerateDocAsync(generateDocCommandLineOptions).Result;

                    case GenerateDocRootCommandLineOptions generateDocRootCommandLineOptions:
                        return GenerateDocRootAsync(generateDocRootCommandLineOptions).Result;

                    case ListSymbolsCommandLineOptions listSymbolsCommandLineOptions:
                        return ListSymbolsAsync(listSymbolsCommandLineOptions).Result;

                    case LogicalLinesOfCodeCommandLineOptions logicalLinesOfCodeCommandLineOptions:
                        return LogicalLinesOrCodeAsync(logicalLinesOfCodeCommandLineOptions).Result;

                    case PhysicalLinesOfCodeCommandLineOptions physicalLinesOfCodeCommandLineOptions:
                        return PhysicalLinesOfCodeAsync(physicalLinesOfCodeCommandLineOptions).Result;

                    case RenameSymbolCommandLineOptions renameSymbolCommandLineOptions:
                        return RenameSymbolAsync(renameSymbolCommandLineOptions).Result;

                    case SpellcheckCommandLineOptions spellcheckCommandLineOptions:
                        return SpellcheckAsync(spellcheckCommandLineOptions).Result;

#if DEBUG
                    case FindSymbolsCommandLineOptions findSymbolsCommandLineOptions:
                        return FindSymbolsAsync(findSymbolsCommandLineOptions).Result;

                    case GenerateSourceReferencesCommandLineOptions generateSourceReferencesCommandLineOptions:
                        return GenerateSourceReferencesAsync(generateSourceReferencesCommandLineOptions).Result;

                    case ListReferencesCommandLineOptions listReferencesCommandLineOptions:
                        return ListReferencesAsync(listReferencesCommandLineOptions).Result;

                    case SlnListCommandLineOptions slnListCommandLineOptions:
                        return SlnListAsync(slnListCommandLineOptions).Result;
#endif
                    default:
                        throw new InvalidOperationException();
                    }
                },
                           (AbstractCommandLineOptions options) =>
                {
                    switch (options)
                    {
                    case HelpCommandLineOptions helpCommandLineOptions:
                        return Help(helpCommandLineOptions);

                    case MigrateCommandLineOptions migrateCommandLineOptions:
                        return Migrate(migrateCommandLineOptions);

#if DEBUG
                    case AnalyzeAssemblyCommandLineOptions analyzeAssemblyCommandLineOptions:
                        return AnalyzeAssembly(analyzeAssemblyCommandLineOptions);

                    case ListVisualStudioCommandLineOptions listVisualStudioCommandLineOptions:
                        return ListVisualStudio(listVisualStudioCommandLineOptions);
#endif
                    default:
                        throw new InvalidOperationException();
                    }
                },
                           _ => ExitCodes.Error));
            }
            catch (Exception ex) when(ex is AggregateException ||
                                      ex is FileNotFoundException ||
                                      ex is InvalidOperationException)
            {
                WriteError(ex);
            }
            finally
            {
                parser?.Dispose();
                Out?.Dispose();
                Out = null;
            }

            return(ExitCodes.Error);
        }
Exemplo n.º 17
0
        public void CanLoadHelloCommand()
        {
            var commands = new CommandLoader().LoadCommandsFrom(this);

            Assert.True(commands["hello"] != null);
        }
Exemplo n.º 18
0
        private static void Main(params string[] args)
        {
            IEnumerable <Command> commands = CommandLoader.LoadCommands(typeof(CommandLoader).Assembly)
                                             .Select(c => c.WithOptions(c.Options.OrderBy(f => f, CommandOptionComparer.Name)))
                                             .OrderBy(c => c.Name, StringComparer.InvariantCulture);

            var application = new CommandLineApplication(
                "orang",
                "Search, replace, rename and delete files and its content using the power of .NET regular expressions.",
                commands.OrderBy(f => f.Name, StringComparer.InvariantCulture));

            string?destinationDirectoryPath = null;
            string?dataDirectoryPath        = null;

            if (Debugger.IsAttached)
            {
                destinationDirectoryPath = (args.Length > 0) ? args[0] : @"..\..\..\..\..\docs\cli";
                dataDirectoryPath        = @"..\..\..\data";
            }
            else
            {
                destinationDirectoryPath = args[0];
                dataDirectoryPath        = @"..\src\DocumentationGenerator\data";
            }

            string readmeFilePath = Path.GetFullPath(Path.Combine(destinationDirectoryPath, "README.md"));

            var settings = new MarkdownWriterSettings(
                MarkdownFormat.Default.WithTableOptions(
                    MarkdownFormat.Default.TableOptions | TableOptions.FormatHeaderAndContent));

            using (var sw = new StreamWriter(readmeFilePath, append: false, Encoding.UTF8))
                using (MarkdownWriter mw = MarkdownWriter.Create(sw, settings))
                {
                    mw.WriteStartHeading(1);
                    mw.WriteString("Orang Command-Line Interface");
                    mw.WriteRaw(" <img align=\"left\" src=\"../../images/icon48.png\">");
                    mw.WriteEndHeading();
                    mw.WriteString(application.Description);
                    mw.WriteLine();

                    mw.WriteHeading2("Commands");

                    Table(
                        TableRow("Command", "Description"),
                        application
                        .Commands
                        .Select(f => TableRow(Link(f.Name, f.Name + "-command.md"), f.Description)))
                    .WriteTo(mw);

                    mw.WriteLine();

                    string readmeLinksFilePath = Path.Combine(dataDirectoryPath, "readme_bottom.md");

                    if (File.Exists(readmeLinksFilePath))
                    {
                        mw.WriteRaw(File.ReadAllText(readmeLinksFilePath));
                    }

                    WriteFootNote(mw);

                    Console.WriteLine(readmeFilePath);
                }

            string valuesFilePath = Path.GetFullPath(Path.Combine(destinationDirectoryPath, "OptionValues.md"));

            ImmutableArray <OptionValueProvider> providers = OptionValueProvider.GetProviders(
                commands.SelectMany(f => f.Options),
                OptionValueProviders.ProvidersByName.Select(f => f.Value))
                                                             .ToImmutableArray();

            MDocument document = Document(
                Heading1("List of Option Values"),
                BulletList(providers.Select(f => Link(
                                                f.Name,
                                                MarkdownHelpers.CreateGitHubHeadingLink(f.Name)))),
                providers.Select(provider =>
            {
                return(new MObject[]
                {
                    Heading2(provider.Name),
                    Table(
                        TableRow("Value", " ", "Description"),
                        provider.Values.Select(f => CreateTableRow(f, providers)))
                });
            }));

            document.Add(
                Heading2("Expression Syntax"),
                Table(
                    TableRow("Expression", "Description"),
                    HelpProvider.GetExpressionItems(includeDate: true)
                    .Select(f => TableRow(InlineCode(f.expression), f.description))));

            AddFootnote(document);

            var markdownFormat = new MarkdownFormat(
                tableOptions: MarkdownFormat.Default.TableOptions | TableOptions.FormatContent);

            File.WriteAllText(valuesFilePath, document.ToString(markdownFormat));

            foreach (Command command in application.Commands)
            {
                readmeFilePath = Path.GetFullPath(Path.Combine(destinationDirectoryPath, $"{command.Name}-command.md"));

                using (var sw = new StreamWriter(readmeFilePath, append: false, Encoding.UTF8))
                    using (MarkdownWriter mw = MarkdownWriter.Create(sw))
                    {
                        var writer = new DocumentationWriter(mw);

                        writer.WriteCommandHeading(command, application);
                        writer.WriteCommandDescription(command);

                        mw.WriteLink("Home", "README.md#readme");

                        foreach (string section in new[] { "Synopsis", "Arguments", "Options", "Samples" })
                        {
                            mw.WriteString(" ");
                            mw.WriteCharEntity((char)0x2022);
                            mw.WriteString(" ");
                            mw.WriteLink(section, "#" + section);
                        }

                        mw.WriteLine();

                        writer.WriteCommandSynopsis(command, application);
                        writer.WriteArguments(command.Arguments);
                        writer.WriteOptions(command.Options);

                        string samplesFilePath = Path.Combine(dataDirectoryPath, command.Name + "_bottom.md");

                        if (File.Exists(samplesFilePath))
                        {
                            string content = File.ReadAllText(samplesFilePath);
                            mw.WriteRaw(content);
                        }

                        WriteFootNote(mw);

                        Console.WriteLine(readmeFilePath);
                    }
            }

            Console.WriteLine("Done");

            if (Debugger.IsAttached)
            {
                Console.ReadKey();
            }
        }