cli

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Main

func Main(ver, com string) int

Main is the whole lg command line: flag registration, argument handling, and every mode the binary supports (eval, run, REPL, nREPL, -c compile, -b bundle, -w wasm). It returns an exit code rather than calling os.Exit itself, so an embedding main stays in control of shutdown.

Two limits worth knowing. Flag parsing uses flag.CommandLine, which is ExitOnError: -h and a malformed flag still terminate the process from inside Main, as they do for any Go command. And Main is meant to be called once per process — option state lives in package variables and is not reset, so a second call inherits the first call's flags.

ver and com are the build metadata the ldflags contract puts on the root package; pass "dev" and "none" when you have none.

A third-party binary is then just:

func main() { os.Exit(cli.Main("dev", "none")) }

with the generated interop packages blank-imported alongside it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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