flagforge

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

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 8 Imported by: 0

README

flagforge

Circle CI

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Argument

type Argument struct {
	Name      string `mapstructure:"name"`
	Type      string `mapstructure:"type"`
	Required  bool   `mapstructure:"required"`
	ShortHelp string `mapstructure:"short_help"`
	LongHelp  string `mapstructure:"long_help"`
}

Argument represents a single argument configuration.

type Flag

type Flag struct {
	Name      string      `mapstructure:"name"`
	CLI       string      `mapstructure:"cli"`
	Type      string      `mapstructure:"type"`
	Default   interface{} `mapstructure:"default"`
	ShortHelp string      `mapstructure:"short_help"`
	LongHelp  string      `mapstructure:"long_help"`
}

Flag represents a single flag configuration.

type Format

type Format int

Format represents the output format of the generator.

const (
	Go Format = iota
	Markdown
	HTML
)

func (Format) String

func (f Format) String() string

String returns the string representation of the format.

type Generator

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

Generator represents a flag, HTML, or Markdown generator.

func NewGenerator

func NewGenerator(cfg *ParsedConfig) (*Generator, error)

NewGenerator creates a new generator with the given package name, name, and path to the TOML configuration file.

func (*Generator) Execute

func (g *Generator) Execute(f Format, w io.Writer) error

Execute generates the output in the given format and writes it to the given writer.

type GoConfig

type GoConfig struct {
	Package           string `mapstructure:"package"`
	ConfigTypeName    string `mapstructure:"config_type_name"`
	FlagSetUsage      string `mapstructure:"flag_set_usage"`
	FlagSetName       string `mapstructure:"flag_set_name"`
	FlagErrorHandling string `mapstructure:"flag_error_handling"`
}

GoConfig represents the configuration for the generated Go code.

type ParsedConfig

type ParsedConfig struct {
	GoConfig  GoConfig
	Arguments []Argument
	Flags     []Flag
}

type Parser

type Parser struct {
}

func NewParser

func NewParser() *Parser

func (*Parser) ParsePath

func (p *Parser) ParsePath(path string) (*ParsedConfig, error)

func (*Parser) ParseReader

func (p *Parser) ParseReader(r io.Reader) (*ParsedConfig, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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