Skip to main content

Crate pxh

Crate pxh 

Source

Modules§

config
helpers
recall
secrets_patterns
sync
Database merge engine for sync.
ui
How pxh talks to a human.

Structs§

Cell 🔒
One cell of the show table: text (possibly several lines) and its color.
Invocation
QueryResultColumnDisplayer 🔒

Enums§

PrettyExportString 🔒

Constants§

BOLD_BLUE 🔒
CURRENT_SCHEMA_VERSION
Current schema version – bump when adding new migrations below.
CYAN 🔒
DIM 🔒
GREEN 🔒
MAGENTA 🔒
RED 🔒
TIME_FORMAT 🔒
WHITE 🔒

Functions§

atomically_remove_lines_from_file
atomically_remove_matching_lines_from_file
Rewrite a file removing lines that exactly match any of the contraband items. Unlike atomically_remove_lines_from_file, this matches complete lines (after trimming).
binary_display_helper 🔒
dedup_invocations 🔒
default_db_path
Return the default database path (pxh_data_dir()/pxh.db).
displayers 🔒
effective_host_set
Build the set of hostnames that count as “this host” for recall filtering. Returns {current_hostname} ∪ {aliases}, deduped.
format_local_time
A Unix timestamp rendered in the system time zone with a strftime format, or None when it is outside jiff’s representable range.
generate_import_session_id 🔒
get_hostname
get_setting
import_bash_history
import_json_history
import_zsh_history
initialize_base_schema
Initialize base schema (persistent tables and indexes only). Safe to call on foreign databases (scan/scrub –dir) – all DDL is idempotent.
initialize_full_schema
Set up the in-memory memdb tables and register the REGEXP function. Only needed by commands that use memdb.show_results or REGEXP (show, scrub).
is_busy 🔒
join_continuation_lines
Join backslash-continuation lines in zsh EXTENDED_HISTORY format. Lines ending with \ are joined with their successor using \n as separator.
json_export
migrate_host_settings
Migrate host settings from DB legacy storage to config file. Called from install and config commands, not on every connection.
present_results_human_readable
pxh_config_dir
Return the pxh config directory. Prefers XDG, falls back to ~/.pxh if it exists. New installs default to $XDG_CONFIG_HOME/pxh (~/.config/pxh).
pxh_data_dir
Return the pxh data directory. Prefers XDG, falls back to ~/.pxh if it exists. New installs default to $XDG_DATA_HOME/pxh (~/.local/share/pxh).
read_local_machine_id
Read this database’s local_machine_id setting, parsed as u64. Accepts either TEXT or BLOB storage so we tolerate values written by non-pxh tooling. Returns None if the setting is absent or unparseable – callers should fall back to non-watermarked behavior in that case.
render_table 🔒
Render rows as a borderless table: one space of padding each side of every cell, every cell padded to its column’s width in terminal columns, a multi-line cell continued on the following lines, and each cell’s style wrapping content and padding together. Colors are emitted unconditionally; the caller prints through anstream, which strips them when stdout is not a terminal.
resolve_hostname
Resolve hostname: config > DB setting (legacy “original_hostname”) > live hostname.
resolve_through_symlinks 🔒
Resolve symlinks in a path, even if the final target doesn’t exist yet. Walks components left-to-right: canonicalizes each prefix that exists on disk, follows symlinks whose targets don’t exist yet, and appends remaining components.
run_schema_migrations
Run versioned schema migrations tracked via PRAGMA user_version.
set_setting
sqlite_connection
Open a lightweight connection (persistent schema only, no memdb/regexp). Use for hot-path commands like insert and seal.
sqlite_connection_full
Open a full connection with memdb tables and REGEXP function. Use for commands that need memdb.show_results or REGEXP (show, scrub, scan).
sqlite_connection_inner 🔒
time_display_helper 🔒
unix_now
Seconds since the Unix epoch; 0 if the clock is before it.
unmetafy
Undo zsh’s internal “metafication”: bytes in its token range are stored as 0x83 followed by the byte XOR 0x20. Most CJK and emoji UTF-8 sequences contain such bytes, so history written by zsh must be decoded before use.
with_write_retry
Run f against a write transaction, retrying on SQLITE_BUSY/SQLITE_LOCKED with exponential backoff and jitter. Each attempt uses BEGIN IMMEDIATE so contention is detected up front rather than mid-transaction. Gives up once max_total elapses and returns the final busy error.

Type Aliases§

BoxError 🔒