Skip to main content

hm_plugin_cloud/
lib.rs

1//! Cloud client library for the hm CLI.
2//!
3//! Implements `hm cloud {login,logout,whoami,org,pipeline,build,job,billing,run}`.
4
5#![allow(
6    clippy::pedantic,
7    clippy::nursery,
8    clippy::cargo,
9    clippy::multiple_crate_versions,
10    clippy::cargo_common_metadata,
11    clippy::missing_errors_doc,
12    reason = "quick migration from plugin crate; polish later"
13)]
14
15pub mod cli;
16pub mod settings;
17
18mod auth;
19mod verbs;
20
21/// Run the interactive browser-loopback login flow.
22///
23/// Designed for embedding in host commands (e.g. `hm init`) that need
24/// the user to authenticate before proceeding.
25///
26/// # Errors
27///
28/// Returns an error if the browser cannot be opened, the login times
29/// out, or the token cannot be persisted.
30pub async fn login_interactive() -> anyhow::Result<()> {
31    let env: std::collections::BTreeMap<String, String> = std::env::vars().collect();
32    auth::login::run(&env, false).await
33}