cmd

package
v0.0.0-...-4a0a4ce Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: MIT Imports: 21 Imported by: 0

README

Go Report Card GitHub Actions Go Reference codecov

cmd

import "github.com/ag5denis/gomarkdoc/cmd"

Index

func BuildCommand

func BuildCommand() *cobra.Command

func BuildConfig

func BuildConfig(configFile string)

func CheckFile

func CheckFile(b *bytes.Buffer, path string) error

func Compare

func Compare(r1, r2 io.Reader) (bool, error)

func DefaultTags

func DefaultTags() []string

func EmbedContents

func EmbedContents(log logger.Logger, fileName string, text string) string

func GetBuildPackage

func GetBuildPackage(path string, tags []string) (*build.Package, error)

func GetLogLevel

func GetLogLevel(verbosity int) logger.Level

func IsIgnoredDir

func IsIgnoredDir(dirname string) bool

IsIgnoredDir identifies if the dir is one we want to intentionally ignore.

func IsLocalPath

func IsLocalPath(path string) bool

func LoadPackages

func LoadPackages(specs []*PackageSpec, opts CommandOptions) error

func PrintVersion

func PrintVersion()

func ResolveFooter

func ResolveFooter(opts CommandOptions) (string, error)

func ResolveHeader

func ResolveHeader(opts CommandOptions) (string, error)

func ResolveOutput

func ResolveOutput(specs []*PackageSpec, outputTmpl *template.Template) error

func ResolveOverrides

func ResolveOverrides(opts CommandOptions) ([]gomarkdoc.RendererOption, error)

func RunCommand

func RunCommand(paths []string, opts CommandOptions) error

func WriteFile

func WriteFile(fileName string, text string) error

WriteFile writes the specified text to the specified file.

func WriteOutput

func WriteOutput(specs []*PackageSpec, opts CommandOptions) error

WriteOutput writes the Output of the documentation to the specified files.

type CommandOptions

type CommandOptions struct {
    Repository            lang.Repo
    Output                string
    Header                string
    HeaderFile            string
    Footer                string
    FooterFile            string
    Format                string
    Tags                  []string
    TemplateOverrides     map[string]string
    TemplateFileOverrides map[string]string
    Verbosity             int
    IncludeUnexported     bool
    Check                 bool
    Embed                 bool
    Version               bool
}

type PackageSpec

PackageSpec defines the data available to the --Output option's template. Information is recomputed for each package generated.

type PackageSpec struct {
    // Dir holds the local path where the package is located. If the package is
    // a remote package, this will always be ".".
    Dir string

    // ImportPath holds a representation of the package that should be unique
    // for most purposes. If a package is on the filesystem, this is equivalent
    // to the value of Dir. For remote packages, this holds the string used to
    // import that package in code (e.g. "encoding/json").
    ImportPath string
    IsWildcard bool
    IsLocal    bool
    OutputFile string
    Pkg        *lang.Package
}
func GetSpecs
func GetSpecs(paths ...string) []*PackageSpec

Generated by gomarkdoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCommand

func BuildCommand() *cobra.Command

func BuildConfig

func BuildConfig(configFile string)

func CheckFile

func CheckFile(b *bytes.Buffer, path string) error

func Compare

func Compare(r1, r2 io.Reader) (bool, error)

func DefaultTags

func DefaultTags() []string

func EmbedContents

func EmbedContents(log logger.Logger, fileName string, text string) string

func GetBuildPackage

func GetBuildPackage(path string, tags []string) (*build.Package, error)

func GetLogLevel

func GetLogLevel(verbosity int) logger.Level

func IsIgnoredDir

func IsIgnoredDir(dirname string) bool

IsIgnoredDir identifies if the dir is one we want to intentionally ignore.

func IsLocalPath

func IsLocalPath(path string) bool

func LoadPackages

func LoadPackages(specs []*PackageSpec, opts CommandOptions) error

func PrintVersion

func PrintVersion()

func ResolveFooter

func ResolveFooter(opts CommandOptions) (string, error)

func ResolveHeader

func ResolveHeader(opts CommandOptions) (string, error)

func ResolveOutput

func ResolveOutput(specs []*PackageSpec, outputTmpl *template.Template) error

func ResolveOverrides

func ResolveOverrides(opts CommandOptions) ([]gomarkdoc.RendererOption, error)

func RunCommand

func RunCommand(paths []string, opts CommandOptions) error

func WriteFile

func WriteFile(fileName string, text string) error

WriteFile writes the specified text to the specified file.

func WriteOutput

func WriteOutput(specs []*PackageSpec, opts CommandOptions) error

WriteOutput writes the Output of the documentation to the specified files.

Types

type CommandOptions

type CommandOptions struct {
	Repository            lang.Repo
	Output                string
	Header                string
	HeaderFile            string
	Footer                string
	FooterFile            string
	Format                string
	Tags                  []string
	TemplateOverrides     map[string]string
	TemplateFileOverrides map[string]string
	Verbosity             int
	IncludeUnexported     bool
	Check                 bool
	Embed                 bool
	Version               bool
}

type PackageSpec

type PackageSpec struct {
	// Dir holds the local path where the package is located. If the package is
	// a remote package, this will always be ".".
	Dir string

	// ImportPath holds a representation of the package that should be unique
	// for most purposes. If a package is on the filesystem, this is equivalent
	// to the value of Dir. For remote packages, this holds the string used to
	// import that package in code (e.g. "encoding/json").
	ImportPath string
	IsWildcard bool
	IsLocal    bool
	OutputFile string
	Pkg        *lang.Package
}

PackageSpec defines the data available to the --Output option's template. Information is recomputed for each package generated.

func GetSpecs

func GetSpecs(paths ...string) []*PackageSpec

Directories

Path Synopsis
Package gomarkdoc provides a command line interface for writing golang documentation in markdown Format.
Package gomarkdoc provides a command line interface for writing golang documentation in markdown Format.

Jump to

Keyboard shortcuts

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