docgen

package module
v0.0.0-...-e3309ab Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: BSD-3-Clause Imports: 16 Imported by: 0

README

docgen

Latest release Build status Go Report Card Documentation

Package docgen

go get github.com/go-pogo/docgen
import "github.com/go-pogo/docgen"

Documentation

Additional detailed documentation is available at pkg.go.dev

Created with

License

Copyright © 2021 Roel Schut. All rights reserved.

This project is governed by a BSD-style license that can be found in the LICENSE file.

Documentation

Index

Constants

View Source
const (
	ScanModule ScanMode = 1 << iota
	ScanPackages
	ScanDeep

	ScanNone         ScanMode = 0
	ScanAll                   = ScanModule | ScanPackages
	ScanAllDeep               = ScanModule | ScanPackages | ScanDeep
	ScanPackagesDeep          = ScanPackages | ScanDeep
)

Variables

This section is empty.

Functions

func ScanDir

func ScanDir(path string, mode ScanMode, filter ScannerFilter) ([]*Module, []*Package, error)

ScanDir scans for modules and packages according to mode. When mode has flag ScanDeep, subdirectories are also scanned if ScannerFilter filter returns true for the subdirectory. When filter is nil, ScanFilter is used as a ScannerFilterFunc.

func ScanFilter

func ScanFilter(_, name string, _ fs.DirEntry) bool

ScanFilter is the default ScannerFilterFunc used in ScanDir. It returns false when name starts with a dot or equals "internal".

Types

type Block

type Block interface {
	String() string
	// contains filtered or unexported methods
}

type Generator

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

func Must

func Must(gen *Generator, err error) *Generator

func New

func New(rootDir string) *Generator

func (*Generator) AbsPath

func (g *Generator) AbsPath(path string) string

AbsPath returns an absolute path from Root.

func (*Generator) Generate

func (g *Generator) Generate(tmplFile string, wr io.Writer) (*Generator, error)

func (*Generator) GenerateFile

func (g *Generator) GenerateFile(template, file string, perm os.FileMode) (*Generator, error)

func (*Generator) Root

func (g *Generator) Root() string

func (*Generator) ScanDir

func (g *Generator) ScanDir(dir string, mode ScanMode, filter ScannerFilter) (*Generator, error)

type Module

type Module struct {
	module.Version
	Deps     []module.Version
	FilePath string
}

func NewModule

func NewModule(ver module.Version) *Module

func NewModuleFromModfile

func NewModuleFromModfile(file *modfile.File) *Module

type Package

type Package struct {
	// Name of package as used with a package statement.
	Name string
	// Path relative to Module.Path, when joined they form ImportPath.
	Path string

	Module   *Module
	Sections []*Section
}

func NewPackage

func NewPackage(name, path string, mod *Module) *Package

func (*Package) ImportPath

func (p *Package) ImportPath() string

func (*Package) Section

func (p *Package) Section(i int) *Section

func (*Package) Synopsis

func (p *Package) Synopsis() string

type ParaBlock

type ParaBlock string

func (ParaBlock) String

func (b ParaBlock) String() string

type PreBlock

type PreBlock string

func (PreBlock) String

func (b PreBlock) String() string

type ScanMode

type ScanMode uint8

type ScannerFilter

type ScannerFilter interface {
	FilterScan(path, name string, entry fs.DirEntry) bool
}

type ScannerFilterFunc

type ScannerFilterFunc func(path, name string, entry fs.DirEntry) bool

func (ScannerFilterFunc) FilterScan

func (f ScannerFilterFunc) FilterScan(path, name string, entry fs.DirEntry) bool

type Section

type Section struct {
	Id      string
	Heading string
	Blocks  []Block
}

func NewSection

func NewSection(id string) *Section

Jump to

Keyboard shortcuts

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