Crate onebm

Crate onebm 

Source
Expand description

§1bm: single binary manager

This is a CLI application. This documentation is for internal details. The crate is named onebm because Cargo doesn’t allow crate names starting with numbers.

All the metadata, downloaded binaries, and 1bm itself, are stored under ~/.local/1bm. We intentionally don’t use standard directories because we want to make it convenient to manually inspect and change things.

All downloaded binaries are under ~/.local/1bm/bin. The user is asked to add it to PATH to use them.

Metadata are under ~/.local/1bm. Specifically:

  • Installed binary list is at ~/.local/1bm/installed.json. It’s used to keep track of information like version, dist file, and name of each binary.
  • Dist files are at ~/.local/1bm/{FILE_HASH}.1bmdist. The hash is SHA-256 hex digest of the dist file and referenced in the installed binary list.

Structs§

BinaryMeta
Metadata about a binary. Corresponds to one entry in installed.json.
DistFile
Corresponds to a dist file.

Enums§

OnebmError

Statics§

BASE_DIR
BIN_DIR
IBL_PATH
R

Functions§

bin_path
check_update
Check if a binary should be updated. In addition to a bool, the new version is also returned.
download
Download binary and signature.
ensure_path
install_binary
read_binary_list
read_distfile
Read dist file from either local path or an URL.
read_distfile_for_binary
sha256
timestamp_now
uninstall_binary
update_binary
verify
write_binary_list

Type Aliases§

TResult