repoconfig

package
v0.24.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package repoconfig is a repo's settings file as the CLI keeps it on disk: where it is in a folder, reading it there, and changing one value in it (SetString), which changes nothing but the value it sets. What the settings are, and how they're read and layered, is shared/repoconfig's.

Index

Constants

View Source
const FileName = "config.yml"

FileName is the settings file, in the repo's config folder.

View Source
const RelPath = repoconfig.FilePath

RelPath is the settings file's path in a repo, as messages name it.

Variables

This section is empty.

Functions

func Hint

func Hint(section, key string) string

Hint is how a message names a setting, for a person to find it: ".anfra/config.yml org.url".

func LocalKeys added in v0.22.0

func LocalKeys(dir string) ([]repoconfig.Key, error)

LocalKeys are the settings the member's own file in the repo at dir sets, in the file's order: none when it has no such file.

func LocalPath added in v0.22.0

func LocalPath(dir string) string

LocalPath is the member's own settings file in the repo at dir (repoconfig.LocalFilePath).

func Path

func Path(dir string) string

Path is the settings file of the repo at dir.

func SetString

func SetString(path, section, key, value string) error

SetString sets section.key to value in the YAML file at path, as git config sets a key: the file is parsed only to find where things are, and the new file is the old one's bytes with the value's bytes replaced, so comments, order and formatting are untouched; written to a lock file and renamed over the original, so a reader sees one or the other and two writers cannot interleave.

  • No file: it is created.
  • No section: a block for it is appended at the end, which disturbs nothing above it.
  • The key, a scalar on one line: its value's bytes are replaced.
  • Anything else (the section without the key, flow style, a value spanning lines): refused, naming the value to set by hand, rather than guessed at.

value must be a plain scalar that reads back as itself; the result is parsed again and checked before it replaces the file.

func UseV2Compiler added in v0.22.0

func UseV2Compiler(cc command.CommandContext) (bool, error)

UseV2Compiler is whether the invocation's AQL compiles and type-checks with the AQL v2 compiler: the compiler its host set (AQLCompiler), or else a local repo's aql.compiler.version, read on every call, so an edit needs no restart. A managed repo with none set uses v1.

Types

type Config

type Config = repoconfig.Config

Config is a repo's settings (shared/repoconfig.Config).

func Read

func Read(dir string) (Config, error)

Read is the settings the repo at dir runs with on this machine: its settings file, with the member's own file laid over it, key by key. None set when it has neither. A key anfra doesn't know, or a value it doesn't take, in either file is an error rather than ignored, since an ignored setting fails without a sign.

func ReadShared added in v0.22.0

func ReadShared(dir string) (Config, error)

ReadShared is the repo's settings file alone, without the member's own: what a publish sends, and what everyone who has the repo gets.

Jump to

Keyboard shortcuts

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