Documentation
¶
Index ¶
- func PrintDefaults(fs *flag.FlagSet, w io.Writer)
- func ReadInput(path string) ([]byte, error)
- func Version() string
- func VersionFlag(fs *flag.FlagSet, tool string) func(w io.Writer) bool
- func WriteGraph(c *Common, g *layout.Graph) error
- func WriteOutput(path string, data []byte) error
- type Common
- type DetectedInput
- type InputType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrintDefaults ¶
PrintDefaults writes flag defaults using double-dash prefixes.
func Version ¶ added in v0.4.2
func Version() string
Version reports the module version this binary was built from: the tag, when the build came from a tagged commit; a pseudo-version from an untagged one; "(devel)" from a working tree, or from any build with VCS stamping off.
It is read from the build info the toolchain embeds, so nothing has to be passed through -ldflags and no constant can drift from the tag it claims. The one thing it does need is a checkout that HAS the tag: a shallow clone fetched by commit rather than by tag leaves the binary reporting a pseudo-version, which is a build-pipeline bug rather than a code one.
func VersionFlag ¶ added in v0.4.2
VersionFlag registers --version on fs and returns the check to run after Parse: it writes "<tool> <version>" to w and reports whether the command should stop rather than do its work.
It is shared rather than written per command so that every binary in a release archive answers the question the same way. Before this, only ipm-rpc could be asked — it is the one the VS Code extension interrogates — and the other six exited with "flag provided but not defined: -version", which is a poor answer from a tool that was downloaded as part of a versioned tarball.
func WriteGraph ¶
WriteGraph encodes g as layout JSON to --out, honouring --pretty (the shipping default: indented, trailing newline).
func WriteOutput ¶
WriteOutput writes to a --out path, treating "-" as stdout.
Types ¶
type Common ¶
Common holds the flags every layout-consuming command shares: --in/--out/--pretty. Their help text and defaults ARE layout-gen's shipping surface — the dev tools inherit it verbatim.
func RegisterCommon ¶
RegisterCommon registers --in/--out/--pretty on fs and returns the Common whose fields they write. Call it BEFORE registering a tool's addon flags so the shared surface reads first in --help.
type DetectedInput ¶
DetectedInput contains the parsed input and its detected type.
func DetectInput ¶
func DetectInput(data []byte, filename string) (*DetectedInput, error)
DetectInput attempts to detect and parse the input data. Returns the parsed data and its detected type. Tries detection in this order: 1. File extension (.ipmt, .layout.json, .json) 2. Content structure (layout.Graph has Meta.Bounds, model.IpmGraph has Nodes array) 3. IPMT text parsing as fallback
func LoadGraph ¶
func LoadGraph(c *Common) (*DetectedInput, *layout.Graph, error)
LoadGraph returns the layout graph WITHOUT tracing: generate for ipmt/ipm.json, pass through for an already-laid-out layout.json. This is layout-gen's shipping path — no trace machinery, no report.
func LoadReport ¶
func LoadReport(c *Common) (*l7report.Report, *DetectedInput, error)
LoadReport returns a TRACED report — the dev tools' path. A recorded .debug.json is decoded and replayed (generation SKIPPED); for an ipmt/ipm.json input the engine runs with a collecting trace (every decision recorded); a passed-through layout.json yields a graph-only report (no events — the pipeline did not run, so --why has nothing to narrate, but --table/--edges/--facts still work off the graph).