Skip to main content

Crate oboron_cli_core

Crate oboron_cli_core 

Source
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/delete

This crate provides:

  • Path resolutionconfig_path, profile_dir, profile_path, backup_dir.
  • Name validationvalidate_profile_name.
  • Key normalizationnormalize_key_to_hex accepts 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/Oload_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.
  • Backupsbackup_profile saves a timestamped copy before overwrite/delete.
  • Command handlerscommands::* implements the user-facing init / config / profile / key subcommands shared by both binaries, parameterized over a commands::CliInfo supplying the per-binary defaults and the binary name used in error hints.
  • Legacy-dir migrationmigration::ensure_config_root_migrated moves 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.