Expand description
Shared CLI plumbing for the oboron-protocol CLIs (ob and obc).
Both binaries share a config directory at ~/.oboron/:
~/.oboron/
├── config.json # active profile + per-binary defaults
├── profiles/<name>.json # per-profile key + metadata
└── bkp/<name>-<ts>.json # automatic backups on overwrite/deleteThis crate provides:
- Path resolution —
config_path,profile_dir,profile_path,backup_dir. - Name validation —
validate_profile_name. - Key normalization —
normalize_key_to_hexaccepts the canonical 128-char hex form or the legacy 86-char base64 form (during the base64 deprecation period) and returns canonical hex. - Config / profile I/O —
load_config,save_config,load_profile,save_profile,list_profiles,delete_profile,rename_profile. File writes preserve unknown JSON fields so the two binaries don’t clobber each other’s metadata. - Backups —
backup_profilesaves a timestamped copy before overwrite/delete. - Command handlers —
commands::*implements the user-facinginit/config/profile/keysubcommands shared by both binaries, parameterized over acommands::CliInfosupplying the per-binary defaults and the binary name used in error hints. - Legacy-dir migration —
migration::ensure_config_root_migratedmoves a leftover~/.ob/to~/.oboron/on first run of the current tooling, leaving a symlink so any older binary still on the system keeps working against the same data.
Re-exports§
pub use config::load_config;pub use config::save_config;pub use config::Config;pub use key::normalize_key_classify;pub use key::normalize_key_to_hex;pub use key::KeyFormat;pub use paths::backup_dir;pub use paths::config_path;pub use paths::config_root;pub use paths::profile_dir;pub use paths::profile_path;pub use profile::delete_profile;pub use profile::list_profiles;pub use profile::load_profile;pub use profile::load_profile_key;pub use profile::load_profile_key_as_hex;pub use profile::rename_profile;pub use profile::save_profile;pub use profile::validate_profile_name;pub use profile::KeyProfile;pub use profile::LoadedKey;
Modules§
- commands
- Command-handler implementations shared by the oboron-protocol CLIs.
- config
config.json— global config: active profile + per-binary defaults.- key
- Key string normalization.
- migration
- One-time migration of the legacy
~/.ob/config directory to~/.oboron/. - paths
- Path resolution for the
~/.oboron/directory tree. - profile
- Per-profile files at
~/.oboron/profiles/<NAME>.json.