nominal-cli 0.1.0

CLI for automating Nominal workflows
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pub mod asset;
pub mod config;
pub mod user;

use anyhow::Context;
use nominal::{Config, NominalClient};

pub(crate) fn load_client(profile_name: &str) -> anyhow::Result<NominalClient> {
    let config = Config::from_file(None).context("Failed to load config")?;

    let profile = config
        .get_profile(profile_name)
        .ok_or_else(|| anyhow::anyhow!("Profile '{profile_name}' not found"))?;

    NominalClient::from_profile_config(profile)
        .with_context(|| format!("Failed to create client for profile '{profile_name}'"))
}