blob: 7c38f483d2e78a64ee0bc86dfa9a0839d631f75e (
plain)
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
|
use std::fs::File;
use std::io::prelude::*;
use eyre::Result;
use structopt::StructOpt;
use atuin_client::api_client;
use atuin_client::settings::Settings;
#[derive(StructOpt)]
#[structopt(setting(structopt::clap::AppSettings::DeriveDisplayOrder))]
pub struct Cmd {
#[structopt(long, short)]
pub username: String,
#[structopt(long, short)]
pub email: String,
#[structopt(long, short)]
pub password: String,
}
pub fn run(settings: &Settings, username: &str, email: &str, password: &str) -> Result<()> {
let session = api_client::register(settings.sync_address.as_str(), username, email, password)?;
let path = settings.session_path.as_str();
let mut file = File::create(path)?;
file.write_all(session.session.as_bytes())?;
// Create a new key, and save it to disk
let _key = atuin_client::encryption::new_key(settings)?;
Ok(())
}
|