struct_markdown

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

README

struct-markdown

struct-markdown will read all go structs that have fields with a mapstructure tag, for Example:

//go:generate packer-sdc struct-markdown

// Config helps configure things
type Config struct {

	// The JSON file containing your account credentials. Not required if you
	// run Packer on a HappyCloud instance with a service account. Instructions for
	// creating the file or using service accounts are above.
	AccountFile string `mapstructure:"account_file" required:"false"`

	// Foo is an example field.
	Foo string `mapstructure:"foo" required:"true"`

This will generate a Config.mdx file containing the header docs of the Config struct, a Config-not-required.mdx file containing the docs for the the account_file field and a Config-required.mdx file containing the docs for the foo field. This is quite helpful in the sense that the code now becomes the single source of truth for docs. In Packer, many common structs are reused in internal and external plugins, this binary makes it possible to use these the docs too. See the documentation for renderdocs for further info.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
}

func (*Command) Help

func (cmd *Command) Help() string

func (*Command) Run

func (cmd *Command) Run(args []string) int

func (*Command) Synopsis

func (cmd *Command) Synopsis() string

type Field

type Field struct {
	Name string
	Type string
	Docs string
}

type Struct

type Struct struct {
	SourcePath string
	Name       string
	Filename   string
	Header     string
	Fields     []Field
}

Jump to

Keyboard shortcuts

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