person

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 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 person names the person running Physa. It prefers the person's setting, then their forge login (kept in the setting for next time), then the part of their git email before the "@". It never uses git's author name. Resolve runs no program: callers hand in the lookups, and ForRepo hands in the usual ones for a repository.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknown = errors.New("person unknown: no setting, no forge login and no git email")

ErrUnknown means no source named the person.

Functions

func ConfigDir

func ConfigDir() (string, error)

ConfigDir returns Physa's config directory.

func ForRepo

func ForRepo(dir string, f forge.Forge, stderr io.Writer) string

ForRepo names the person running Physa in the repository at dir: their setting, else the login of the account f's forge signs them in as, else their git email. When no name can be had it says why on stderr, once, and returns "": the person is unknown, never guessed.

Types

type Name

type Name struct {
	Name   string
	Source Source
	// Kept says a forge login was written to the setting file.
	Kept bool
}

Name is the resolved person.

func Resolve

func Resolve(o Options) (Name, error)

Resolve names the person: setting, else forge login (kept), else email.

type Options

type Options struct {
	ConfigDir string
	Login     func() (string, error)
	Email     func() (string, error)
}

Options holds where to look. A nil lookup is skipped.

type Source

type Source string

Source says where a name came from.

const (
	// Setting is the file in the config directory.
	Setting Source = "setting"
	// Forge is the person's login on the forge.
	Forge Source = "forge"
	// Email is the part of git's email before the "@".
	Email Source = "email"
)

Jump to

Keyboard shortcuts

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