Documentation ¶
Index ¶
- Constants
- func Build(log *log.Logger, optimize bool, inputDir, outputFilepath string) error
- func BuildMain(log *log.Logger, inputDir, filePath string) error
- func GenerateShellCompletion(shell string, cmd *cobra.Command) error
- func GetPlainType(field *ast.Field) string
- func GetValidTargets(dir string) []string
- func Run(opts RunOpts, args []string) error
- type Argument
- type Context
- type GoCmd
- type GoFlag
- type RunOpts
Constants ¶
View Source
const GOGOIMPORTPATH = "github.com/3b-tools/gogo"
View Source
const MAIN_FILENAME = "main.gogo.go"
Variables ¶
This section is empty.
Functions ¶
func Build ¶
Build reads all the gogo files in the directory, applies their configuration options, and builds the resulting binary.
func BuildMain ¶
BuildMain reads all the gogo files in the directory, applies their configuration options, and builds the resulting main file.
func GenerateShellCompletion ¶
TODO: we need to write our own versions of these, but for now...
func GetPlainType ¶
GetPlainType takes an *ast.Field and returns a plain-English type description
func GetValidTargets ¶
GetValidTargets determines the collection of available functions in the directory, plus the global functions
Types ¶
type Argument ¶
type Argument interface { Long(string) Argument // Override the argument name in auto-complete and arguments when calling this function. Defaults to the name of the argument. Short(byte) Argument // The short character for the argument Default(any) Argument Help(string) Argument AllowedValues(...any) Argument RestrictedValues(...any) Argument Description(string) Argument // The short description of the argument. Argument(any) Argument // Start describing a different argument. }
type Context ¶
type Context interface { stdContext.Context SetDescription(string) Context // This becomes the short description of the command. SetLongDescription(string) Context // The becomes the long description of the command. This is normally inferred from the comment of the function. Example(string) Context // What would this go to? Argument(any) Argument }
type GoFlag ¶
type GoFlag struct { Type string // string, int, bool, float64 This type is inferred from reading the code. Name string // name of the flag Short string // short name of the flag Default any // default value of the flag Help string // help text for the flag AllowedValues []any // if provided, only these values are allowed, and are auto-completed in the shell RestrictedValues []any // if provided, prohibits this flag from being set to these values. Panics if detected. }
type RunOpts ¶
type RunOpts struct { Verbose bool `json:"GOGO_VERBOSE"` // output verbose information when RUNNING gogo AND the sub-command Optimize bool `json:"GOGO_OPTIMIZE"` // should the functions be compiled with optimization flags during this run GlobalDir string `json:"GOGO_GLOBAL_DIR"` // the global location for gogo functions IndividualBinaries bool `json:"GOGO_INDIVIDUAL_BINARIES"` // When true, each function results in a binary of the same name }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.