mdtogo

command module
v0.0.0-...-e244b83 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL