go2readme

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

generate from go code to README

Index

Examples

Constants

This section is empty.

Variables

View Source
var DefualtFuncMap = FuncMap{
	"import": ImportFunc,
	"exists": ExistsFunc,
	"glob":   GlobFunc,
}

Functions

func ExistsFunc

func ExistsFunc(fname string) bool

func GlobFunc

func GlobFunc(fname string) []string

func ImportFunc

func ImportFunc(fname string) string

Types

type Document

type Document struct {
	// contains filtered or unexported fields
}
Example

Document output

// read template
templ := template.Must(template.ParseFiles("template.md"))
d, err := NewDocument(".", templ)
if err != nil {
	return
}

var buf bytes.Buffer
err = d.WriteTo(&buf)
if err != nil {
	return
}

fmt.Println(buf.String())
Output:

func NewDocument

func NewDocument(dir string, templ Template) (*Document, error)

func (*Document) Description

func (d *Document) Description() string

func (*Document) Examples

func (d *Document) Examples() []*Example

func (*Document) ImportPath

func (d *Document) ImportPath() string

func (*Document) IsCommand

func (d *Document) IsCommand() bool

func (*Document) Name

func (d *Document) Name() string

func (*Document) Synopsis

func (d *Document) Synopsis() string

func (*Document) Usage

func (d *Document) Usage() string

func (*Document) WriteTo

func (d *Document) WriteTo(w io.Writer) error

type Example

type Example struct {
	// contains filtered or unexported fields
}

func NewExamples

func NewExamples(fset *token.FileSet, examples ...*doc.Example) []*Example

func (*Example) Code

func (e *Example) Code() string

func (*Example) Doc

func (e *Example) Doc() string

func (*Example) Name

func (e *Example) Name() string

func (*Example) Output

func (e *Example) Output() string

func (*Example) Play

func (e *Example) Play() string

type FuncMap

type FuncMap map[string]interface{}

type Template

type Template interface {
	Execute(w io.Writer, data interface{}) error
}

Directories

Path Synopsis
cmd
go2readme
generate README for Go program
generate README for Go program

Jump to

Keyboard shortcuts

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