MCPcopy Create free account
hub / github.com/BigBoot/AutoKuma / connect

Function connect

kuma-cli/src/utils.rs:19–41  ·  view source on GitHub ↗
(config: &Config, cli: &Cli)

Source from the content-addressed store, hash-verified

17pub(crate) type Result<T> = kuma_client::error::Result<T>;
18
19pub(crate) async fn connect(config: &Config, cli: &Cli) -> kuma_client::Client {
20 let config = if config.auth_token.is_none() {
21 Config {
22 auth_token: load_auth_token().await,
23 ..config.clone()
24 }
25 } else {
26 config.clone()
27 };
28
29 let client = kuma_client::Client::connect(config)
30 .await
31 .unwrap_or_die(cli);
32
33 if cli.store_auth_token {
34 let auth_token = client.get_auth_token().await;
35 if let Some(auth_token) = auth_token {
36 store_auth_token(&auth_token).await;
37 }
38 }
39
40 client
41}
42
43#[derive(ValueEnum, Clone, Debug)]
44pub(crate) enum OutputFormat {

Callers 11

mainFunction · 0.85
mainFunction · 0.85
get_connectionMethod · 0.85
handleFunction · 0.85
handleFunction · 0.85
handleFunction · 0.85
handleFunction · 0.85
handleFunction · 0.85
handleFunction · 0.85
handleFunction · 0.85
handleFunction · 0.85

Calls 4

load_auth_tokenFunction · 0.85
store_auth_tokenFunction · 0.85
get_auth_tokenMethod · 0.80
unwrap_or_dieMethod · 0.45

Tested by

no test coverage detected