pack

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pack writes packs into a project. A pack is a directory of ready-made machines, in a git repository or on this computer.

Index

Constants

View Source
const Dir = ".packs"

Dir is the directory in a project that holds its packs. Corbie rewrites it, and a person changes nothing in it.

Variables

This section is empty.

Functions

func Added

func Added(project string) (map[string]Source, map[string]map[string]string, error)

Added gives the source and the words of each pack in a project that a person added, by the pack's name, as its record holds them.

Types

type Report

type Report struct {
	Packs   []Written `json:"packs"`
	Started []string  `json:"started"` // the starting files it wrote
	Differ  []string  `json:"differ"`  // the starting files that were there, and are not as the pack starts them
}

A Report is what corbie add did.

func Add

func Add(project string, src Source, words map[string]string) (Report, error)

Add writes a pack into a project. It rewrites the pack's directory under .packs, and that of each pack of the same source that the pack's files name. It writes each starting file that is not there and that it has not written before, with each word set written in place of itself in the file's path and text. It adds .packs/ to the project's .corbieignore when it lacks it. It changes no other file.

type Source

type Source struct {
	Text string // as it was written, with its ref
	Repo string // what git fetches from; empty for a directory that is copied as it is
	Path string // the pack's directory: under the repository, or on this computer
	Ref  string // a tag, a branch or a commit; empty for the default branch
	Name string // the pack's name: the last part of its path
}

A Source is where a pack comes from, as corbie add was given it.

func Parse

func Parse(text string) (Source, error)

Parse reads a pack as it is written: host/owner/repository/path@ref, or a directory on this computer. A repository whose address has more than three parts is written with .git after it, as host/a/b/c.git/path. A directory with a ref is read from the git repository it is in.

type Written

type Written struct {
	Name   string `json:"name"`
	Source string `json:"source,omitempty"` // as corbie add was given it
	Commit string `json:"commit,omitempty"` // the commit it was read at
	Needed string `json:"needed_by,omitempty"`
}

A Written is one pack written into a project.

Jump to

Keyboard shortcuts

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