credent 0.2.0

Manages `~/.config/<app>/credentials`.
Documentation

Credent

Crates.io CI Coverage Status

Manages ~/.config/<app>/credentials.

Usage

use credent::{
    cli::CredentialsCliReader,
    fs::{AppName, CredentialsFile, CredentialsFileStorer},
};

/// Application name
const CREDENT: AppName<'_> = AppName("credent");

fn main() -> Result<(), Box<dyn std::error::Error>> {
    smol::run(async {
        let credentials = CredentialsCliReader::read_from_tty().await?;
        println!("credentials: {}", credentials);

        CredentialsFileStorer::store(CREDENT, &credentials).await?;

        println!(
            "credentials written to: {}",
            CredentialsFile::path(CREDENT)?.display()
        );

        Result::<(), Box<dyn std::error::Error>>::Ok(())
    })
}

More sample code can be seen in the examples.

cargo run --example simple
cargo run --example demo
cargo run --example profiles
cargo run --example profiles -- --profile development

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.