Documentation ¶
Overview ¶
Package cliche provides types and functions for declaratively creating CLIs in Go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandInputMetadata ¶
CommandInputMetadata contains details about how a Command's inputs should be mapped to the struct members of the implementing type.
type CommandMetadata ¶
type CommandMetadata struct { // Name of the command to be generated. This defaults to the name of the // package, unless overridden. Name string // Package name from which the Command is sourced. Package string // Type name of the Command implementation. Type string // Help output for the Command. This will be displayed along with usage // information on the command line. By default, sourced from doc comment for // the package in which the wrapped Command will live. Help string // Description of the command. Should be short and human readable. By // default, sourced from the doc comment on the wrapped Command type. Description string // Inputs describe the handling of struct fields on the wrapped Command // implementation as inputs on the command line. The inputs are derived from // struct tags, when set. Inputs []CommandInputMetadata // contains filtered or unexported fields }
CommandMetadata compiles details about how the Command type should be wrapped from the AST describing it. This type is used to execute a Go template, to generate the resulting Go source file.
func FromFile ¶
func FromFile(typeName, file string) *CommandMetadata
FromFile attempts to find a type typeName and generate command metadata from file, returning nil on failure.
Click to show internal directories.
Click to hide internal directories.