feat: generate a CLI help directory instead of 1 file - #55
Open
rschauner wants to merge 2 commits into
Open
Conversation
…ons customization refactor: separate `build_command_markdown` into `write_usage`, `build_command_markdown_subcommands`, `build_command_markdown_parts`, and `write_preamble_markdown`. - The signature also now includes 2 `Vec<String>`. - `build_command_markdown_process` handles creating the vectors and returning a `Markdown` struct. - The `Markdown` struct now holds the output and has methods to write to disk or display strings.
… options and examples test: Add test for multiple files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the CLI documentation gets quite large 5-10 commands, navigating the help can become cumbersome. I wanted to split each subcommand into a different file and link it all back to the main command.
Changes
MarkdownOptionsfor multiple files. It's set as an Enum for clarity, but is really a true/false option.Markdownto hold the output from the help generation commands. It contains 2Vec<String>fields,textandcommands. It also has methods to write to disk (either single file or directory structure) and to convert toString.build_command_markdownnow accepts 2 new argumentsvec_bufferandcmd_buffer. These two vectors hold the help text (vec_buffer) and the command path (cmd_buffer). The command path is built as a path.build_table_of_contents_markdownnow takes amarkdown_optionsargument and returns contents formatted for a directory structure ("*command" or the existing single file structure ("*command↴").Markdownstruct and implemented the existing functions to returnStringstill.Fixes
build()causes duplicate command paths in generated markdown when using subcommands #54 seems to be fixed.