Skip to main content

Module util

Module util 

Source

Constants§

PATH_SEPARATOR

Functions§

current_target_triple
Returns the current target triple (e.g. x86_64-unknown-linux-gnu) based on the host system’s architecture and operating system.
ensure_frate_dirs
Ensures the .frate directory structure exists under the given root path. Creates .frate/bin and .frate/shims if they don’t already exist.
expand_version
Expands a version string to include the target triple. For example, 1.2.3 becomes 1.2.3-x86_64-unknown-linux-gnu.
fetch_description
filter_versions
Filters versions based on platform and architecture
find_installed_paths
Finds the paths of both the installed binary and shim for a given package. Returns a tuple of Option<PathBuf> for (binary, shim).
format_hash
Strips the sha256: prefix from a hash if present. This is useful for formatting hashes uniformly.
get_binary
Searches for the binary file in the .frate/bin/<name> directory. Picks the first executable that matches the tool name heuristically.
get_frate_bin_dir
Returns the path to the .frate/bin directory.
get_frate_dir
Returns the full path to the .frate directory in the current working directory.
get_frate_lock_file
Returns the path to the frate.lock file in the current working directory.
get_frate_shims_dir
Returns the path to the .frate/shims directory.
get_frate_toml
Returns the path to the frate.toml file in the current working directory.
get_locked
Returns the locked package entry for the given name, if it exists.
is_installed
Checks whether a package is installed by verifying the binary path exists.
is_locked
Checks whether a package with the given name is listed in the frate.lock.
is_valid_version
Validates whether a version string is a valid SemVer version. Ignores build metadata and target suffixes.
sort_versions
Sorts a map of version strings to ReleaseInfo entries in descending semver order. Preserves any build or target-triple suffixes.