Module util

Module util 

Source
Expand description

Small utility helpers for encoding, JSON extraction, ranking, and time formatting.

The functions in this module are intentionally lightweight and dependency-free to keep hot paths fast and reduce compile times. They are used by networking, indexing, and UI code.

Modules§

config
Configuration file parsing utilities.
curl
Curl-based HTTP utilities for fetching JSON and text content.
pacman
Pacman command execution utilities.
srcinfo
.SRCINFO fetching utilities for AUR packages.

Functions§

arrs
What: Extract an array of strings from a JSON object by trying keys in order.
curl_args
Build curl command arguments for fetching a URL.
ensure_mouse_capture
What: Ensure mouse capture is enabled for the TUI.
fuzzy_match_rank
Rank how well a package name matches a query using fuzzy matching (fzf-style).
fuzzy_match_rank_with_matcher
Rank how well a package name matches a query using fuzzy matching (fzf-style) with a provided matcher.
match_rank
What: Rank how well a package name matches a query (lower is better).
open_file
What: Open a file in the default editor (cross-platform).
open_url
What: Open a URL in the default browser (cross-platform).
parse_update_entry
What: Parse a single update entry line in the format “name - old_version -> name - new_version”.
percent_encode
What: Percent-encode a string for use in URLs according to RFC 3986.
repo_order
What: Determine ordering weight for a package source.
s
What: Extract a string value from a JSON object by key, defaulting to empty string.
ss
What: Extract the first available string from a list of candidate keys.
today_yyyymmdd_utc
What: Return today’s UTC date formatted as YYYYMMDD using only the standard library.
ts_to_date
What: Convert an optional Unix timestamp (seconds) to a UTC date-time string.
u64_of
What: Extract an unsigned 64-bit integer by trying multiple keys and representations.