magus v0.4.3 is out. See what's new
¶ View generated markdown
1 min read

yaml

YAML parse and stringify (YAML 1.2 via gopkg.in/yaml.v3).

Naming convention: import the module under its bare name (import "yaml"), reach members with a backslash, and call methods in camelCase: yaml\someMethod.

Methods

parse

Decode a YAML string into a value (maps, lists, strings, numbers, bools, null); errors on invalid input.

Signature: yaml\parse(source) -> any - source

Parameter Type Optional Description
source string

Returns: any

positions

Report where each value of a YAML document starts, as {lines, columns}: 1-based, each keyed by the value's JSON pointer ("" for the root, /jobs/build/steps/0 for a list item, ~0 and ~1 escaping ~ and / in a key). A mapping entry is keyed at its value, so /jobs/build is where that job's body starts. An alias is keyed where it appears and not followed. What parse returns carries no positions; this is how a check over it points at a line. Errors on invalid input.

Signature: yaml\positions(source) -> YamlPositions - source

Parameter Type Optional Description
source string

Returns: map[string]any

stringify

Encode a value to a YAML string; errors on unencodable input.

Signature: yaml\stringify(value) -> string - source

Parameter Type Optional Description
value any

Returns: string

generatedreference/buzz/yamlmodulestdlibmagusfile
Last updated (29d8b3de)
Earlier changes on this page (7)

Full history ↗ · Blame source ↗

Glossary

Magusfile

The magusfile.buzz that declares a project's targets (as export funs) and binds its spells. Magusfile in full.

Op

A single tool-native command a target composes (long form: operation); the middle of the work hierarchy (Spell to Op to Target). Op in full.

Module

A magus stdlib namespace a magusfile imports for host capabilities: filesystem, exec, vcs, and more. Module in full.

Buzz

The language magusfiles are written in (the .buzz engine). Buzz in full.

Job

The unit of delegated work, and one row of the job store: what an orchestrating agent handed out, with its goal, the checkpoint it was cut against, the paths it may write or must not touch, and the one check it runs. A job's holder is either a session, for work an orchestrator handed out, or the daemon, for its own maintenance. The store records; the agent guard is what reads those facts back when grading a write. Job in full.

Conventions

This page uses none of the site's convention markers. The full set is on the conventions page.