Documentation ¶
Overview ¶
Package main generates cobra.Command go variables containing documentation read from .md files. Usage: mdtogo SOURCE_MD_DIR/ DEST_GO_DIR/ [--full=true] [--license=license.txt|none]
The command will create a docs.go file under DEST_GO_DIR/ containing string variables to be used by cobra commands for documentation.The variable names are generated from the SOURCE_MD_DIR/ file names, replacing '-' with ”, title casing the filename, and dropping the extension. All *.md will be read from DEST_GO_DIR/, and a single DEST_GO_DIR/docs.go file is generated.
Each .md document will be parsed as follows if no flags are provided:
## cmd This section will be parsed into a string variable for `Short` ### Synopsis This section will be parsed into a string variable for `Long` ### Examples This section will be parsed into a string variable for `Example`
If --full=true is provided, the document will be parsed as follows:
## cmd All sections will be parsed into a Long string.
Flags:
--full=true Create a Long variable from the full .md files, rather than separate sections. --license Controls the license header added to the files. Specify a path to a license file, or "none" to skip adding a license.