commandsgen

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package commandsgen is built to read the YAML format described in temporalcli/commandsgen/commands.yml and generate code from it.

Index

Constants

This section is empty.

Variables

View Source
var CommandsYAML []byte

Functions

func GenerateCommandsCode

func GenerateCommandsCode(pkg string, commands Commands) ([]byte, error)

func GenerateDocsFiles

func GenerateDocsFiles(commands Commands) (map[string][]byte, error)

Types

type Command

type Command struct {
	FullName               string `yaml:"name"`
	NamePath               []string
	Summary                string `yaml:"summary"`
	Description            string `yaml:"description"`
	DescriptionPlain       string
	DescriptionHighlighted string
	HasInit                bool     `yaml:"has-init"`
	ExactArgs              int      `yaml:"exact-args"`
	MaximumArgs            int      `yaml:"maximum-args"`
	IgnoreMissingEnv       bool     `yaml:"ignores-missing-env"`
	Options                []Option `yaml:"options"`
	OptionSets             []string `yaml:"option-sets"`
	Docs                   Docs     `yaml:"docs"`
}

Command represents the structure of each command in the commands map.

type Commands

type Commands struct {
	CommandList []Command    `yaml:"commands"`
	OptionSets  []OptionSets `yaml:"option-sets"`
}

Commands represents the top-level structure holding commands and option sets.

func ParseCommands

func ParseCommands() (Commands, error)

type Docs

type Docs struct {
	Keywords          []string `yaml:"keywords"`
	DescriptionHeader string   `yaml:"description-header"`
}

Docs represents docs-only information that is not used in CLI generation.

type Option

type Option struct {
	Name               string   `yaml:"name"`
	Type               string   `yaml:"type"`
	Description        string   `yaml:"description"`
	Short              string   `yaml:"short,omitempty"`
	Default            string   `yaml:"default,omitempty"`
	Env                string   `yaml:"env,omitempty"`
	Required           bool     `yaml:"required,omitempty"`
	Aliases            []string `yaml:"aliases,omitempty"`
	EnumValues         []string `yaml:"enum-values,omitempty"`
	Experimental       bool     `yaml:"experimental,omitempty"`
	HiddenLegacyValues []string `yaml:"hidden-legacy-values,omitempty"`
}

Option represents the structure of an option within option sets.

type OptionSets

type OptionSets struct {
	Name        string   `yaml:"name"`
	Description string   `yaml:"description"`
	Options     []Option `yaml:"options"`
}

OptionSets represents the structure of option sets.

Jump to

Keyboard shortcuts

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