Documentation
¶
Overview ¶
Package vmname names the VM of a project directory, as 0.2 did but for its prefix: the VMs it made are moved under those names (FromOld).
Index ¶
Constants ¶
const OldPrefix = "agent-vm-"
OldPrefix began every name 0.2 gave its VMs, in a Lima home it shared with the user's: agent-vm's own has no use for it (see FromOld).
const Template = "base"
Template is the base VM every project's VM is cloned from. No project VM has its name: theirs end with a hash.
Variables ¶
var ErrNoDir = errors.New("no such directory")
ErrNoDir is returned by AbsDir for a directory that does not exist.
var MaxLen = 76
MaxLen is the longest name a VM may have: Lima's 76 characters, or less where its sockets would not fit under the Lima home (set from it, see vm.MaxName). Names longer are cut in their folder part (fit).
Functions ¶
func AbsDir ¶
AbsDir is dir (the current directory when empty) as the commands that start a VM spell theirs: absolute, logical (symlinks kept, as `pwd` does; os.Getwd returns $PWD when it names the current directory), without "." or "..". It refuses a directory that does not exist, and a path holding a control character, which would forge lines of `info`'s key=value output.
func FromOld ¶
FromOld is the name of the VM 0.2 named old: without OldPrefix, its base template Template, cut as Name cuts a name too long here.
func IsScratch ¶
IsScratch reports whether name looks like one Scratch makes. It only looks like it: a project folder named "x-scratch" gets a VM named "x-scratch-<hash>", which matches. Deleting a VM unasked takes more than the name, a marker of a --scratch run (state.ScratchOf).
func Name ¶
Name is the VM of the project dir, spelled as `pwd` spells it: the name hashes that string, so /tmp/ and /tmp give one VM and a symlink to the project another. <base>-<hash>, base the folder's name with every run of other characters than ASCII letters and digits made one "-" ("project" when nothing is left), and hash 8 hex digits of the path's SHA-256. On Windows, the path as Git Bash spelled it (/c/...), as 0.2 hashed it.
Types ¶
This section is empty.