compiler

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCommand

func BuildCommand(executable string, args []ExecArg, argValues map[string]string) []string

BuildCommand reconstructs the command from executable, args, and current values. This strips all type hints and uses the actual values.

func InferType

func InferType(value string) string

InferType infers the type of a value based on its content. Returns "number", "bool", or "string".

func IntrospectScript

func IntrospectScript(executable, workDir string) map[string]string

IntrospectScript runs the script with --help and parses flag descriptions. Returns a map of flag name → description. If --help fails or returns no useful info, returns an empty map (no error).

Types

type ExecArg

type ExecArg struct {
	Name        string `json:"name"`        // "name" or "arg1" for positional
	Label       string `json:"label"`       // Display label (custom or auto-generated)
	Type        string `json:"type"`        // "string", "number", "bool"
	Default     string `json:"default"`     // Default value as string
	Position    int    `json:"position"`    // -1 for named flags, 0+ for positional
	Description string `json:"description"` // From --help introspection
}

ExecArg represents a parsed command-line argument

func ParseExecCommand

func ParseExecCommand(cmd string) (executable string, args []ExecArg, err error)

ParseExecCommand parses a command string and extracts the executable and arguments. Supports:

  • Named args: --flag:type value or --flag value (type inferred)
  • Positional args: label:type:value or label:value or just value

All type hints are stripped from the returned args - they're only used to determine the input type for form generation.

Jump to

Keyboard shortcuts

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