1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
use anyhow::{Context, Result};
use clap;
use crate::{
cli::Cli,
client::{Client, Connect},
git::Repo,
login,
};
#[derive(clap::Args)]
pub struct SubCommandArgs {
/// don't fetch user metadata and relay list from relays
#[arg(long, action)]
offline: bool,
}
pub async fn launch(args: &Cli, command_args: &SubCommandArgs) -> Result<()> {
let git_repo = Repo::discover().context("cannot find a git repository")?;
if command_args.offline {
login::launch(
&git_repo,
&args.bunker_uri,
&args.bunker_app_key,
&args.nsec,
&args.password,
None,
true,
false,
)
.await?;
Ok(())
} else {
let client = Client::default();
login::launch(
&git_repo,
&args.bunker_uri,
&args.bunker_app_key,
&args.nsec,
&args.password,
Some(&client),
true,
false,
)
.await?;
client.disconnect().await?;
Ok(())
}
}
|