Skip to main content

Module alias

Module alias 

Source
Expand description

The short ka alias, as a link rather than a second binary.

Until v1.8.1 ka was its own [[bin]]: a second, byte-identical 15 MB executable built, packed into every archive and downloaded by every user, to give one program a second name. A link costs nothing and cannot go stale, because there is only ever one set of bytes:

  • Unix: a symlink, which install.sh already created.
  • Windows: a hard link. Symlinks there need elevation or developer mode, which an installer has no business demanding; hard links do not, as long as both names are on the same volume - and they are, since the alias lands beside the binary.

The one seam is self_update: replacing the binary renames the old file aside and moves a new one in, which breaks the link, so an update re-links afterwards - that is what refresh is for.

Which name needs repairing depends on which one was typed. An update replaces the file it is running from, so ka self-update replaces ka and leaves kasl behind, mirroring the usual case exactly. Both are handled by asking for the counterpart rather than for “the alias” - asking the wrong question there cost turnout a vanishing binary (its ADR 0015), and the same mistake is available here.

Enums§

Outcome
What refresh found and did.

Constants§

ALIAS
The alias name, without any platform extension.
PRIMARY
The primary name, without any platform extension.

Functions§

counterpart
The other name of this install: the alias when running as kasl, and kasl when running as the alias.
link
Point alias at exe, replacing whatever is already there.
refresh
Re-point this install’s other name at the binary an update just replaced.