package docs
import "github.com/purpleidea/mgmt/docs"
Package docs provides a tool that generates documentation from the source.
./mgmt docs generate --output /tmp/docs.json && cat /tmp/docs.json | jq
Index ¶
- Constants
- type API
- type Config
- type FunctionInfo
- type Generate
- func (obj *Generate) Main(ctx context.Context) error
- func (obj *Generate) Run(ctx context.Context) error
- func (obj *Generate) Validate() error
- type Output
- type ResourceFieldInfo
- type ResourceInfo
Constants ¶
const ( // JSONSuffix is the output extension for the generated documentation. JSONSuffix = ".json" )
Types ¶
type API ¶
API is the simple interface we expect for any setup items.
type Config ¶
type Config struct { }
Config is a struct of all the configuration values which are shared by all of the setup utilities. By including this as a separate struct, it can be used as part of the API if we want.
type FunctionInfo ¶
type FunctionInfo struct { // Name is the golang name of this function. This may be an actual // function if used by the simple API, or the name of a struct. Name string `json:"name"` // Package is the import name to use to get to this function. Package string `json:"package"` // Func is the name of the function in that package. Func string `json:"func"` // File is the file name where this function exists. File string `json:"file"` // Desc explains what this function does. Desc string `json:"description"` // Signature is the type signature of this function. If empty then the // signature is not known statically and it may be polymorphic. Signature *string `json:"signature,omitempty"` }
FunctionInfo stores some information about each function.
type Generate ¶
type Generate struct { *cliUtil.DocsGenerateArgs // embedded config Config // embedded Config // Program is the name of this program, usually set at compile time. Program string // Version is the version of this program, usually set at compile time. Version string // Debug represents if we're running in debug mode or not. Debug bool // Logf is a logger which should be used. Logf func(format string, v ...interface{}) }
Generate is the main entrypoint for this command. It generates everything.
func (*Generate) Main ¶
Main runs everything for this setup item.
func (*Generate) Run ¶
Run performs the desired actions to generate the documentation.
func (*Generate) Validate ¶
Validate verifies that the structure has acceptable data stored within.
type Output ¶
type Output struct { // Version is the sha1 or ref name of this specific version. This is // used if we want to generate documentation with links matching the // correct version. If unspecified then this assumes git master. Version string `json:"version"` // Resources contains the collection of every available resource! // FIXME: should this be a list instead? Resources map[string]*ResourceInfo `json:"resources"` // Functions contains the collection of every available function! // FIXME: should this be a list instead? Functions map[string]*FunctionInfo `json:"functions"` }
Output is the type of the final data that will be for the json output.
type ResourceFieldInfo ¶
type ResourceFieldInfo struct { // Name is what this field is called in golang format. Name string `json:"name"` // Type is the mcl type for this field. Type string `json:"type"` // Desc explains what this field does. Desc string `json:"description"` }
ResourceFieldInfo stores some information about each field in each resource.
type ResourceInfo ¶
type ResourceInfo struct { // Name is the golang name of this resource. Name string `json:"name"` // Kind is the kind of this resource. Kind string `json:"kind"` // File is the file name where this resource exists. File string `json:"file"` // Desc explains what this resource does. Desc string `json:"description"` // Fields is a collection of each resource field and corresponding info. Fields map[string]*ResourceFieldInfo `json:"fields"` }
ResourceInfo stores some information about each resource.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
docs/util | Package util handles metadata for documentation generation. |
- Version
- v0.0.0-20250322185616-c50a578426f1 (latest)
- Published
- Mar 22, 2025
- Platform
- linux/amd64
- Imports
- 17 packages
- Last checked
- 4 days ago –
Tools for package owners.