ffmd

package module
Version: v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: MIT Imports: 9 Imported by: 0

README

ffmd

Go Reference

One of the things that I really liked about urfave/cli was that it could generate markdown docs for my commands.

With ffmd you can generate markdown docs for both flag.FlagSet and ffcli.Command (with any amount of sub-commands).

Check out examples for some sample generated docs.

Generate your docs

//go:build generate
// +build generate

package main

import (
	"os"
	
	"go.jolheiser.com/ffmd"
)

func main() {
	fi, err := os.Create("docs.md")
	if err != nil {
		panic(err)
    }
	defer fi.Close()

	// cmd is the ffcli.Command 
	md, err := ffmd.Command(cmd)
	if err != nil {
		panic(err)
    }
	
	if _, err := fi.WriteString(md); err != nil {
		panic(err)
    }
}

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Template = template.Must(template.New("").Parse(ffmdtmpl))
)

Functions

func Command added in v0.0.2

func Command(cmd *ffcli.Command) (string, error)

Command turns a ffcli.Command into markdown

func FlagSet added in v0.0.2

func FlagSet(fs *flag.FlagSet) (string, error)

FlagSet turns a flag.FlagSet into markdown

func Tree

func Tree(cmd *ffcli.Command) string

Tree returns a tree-representation of a ffcli.Command

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

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