From c05d2850420a2c163b8f62c33a6cef7c0ae1ad8d Mon Sep 17 00:00:00 2001 From: Vladislav Stepanov <8uk.8ak@gmail.com> Date: Fri, 14 Apr 2023 23:18:58 +0400 Subject: Workspace reorder (#868) * Try different workspace structure Move main crate (atuin) to be on the same level with other crates in this workspace * extract common dependencies to the workspace definition * fix base64 v0.21 deprecation warning * questionable: update deps & fix chrono deprecations possible panic sites are unchanged, they're just more visible now * Revert "questionable: update deps & fix chrono deprecations" This reverts commit 993e60f8dea81a1625a04285a617959ad09a0866. --- src/command/client/sync/register.rs | 49 ------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 src/command/client/sync/register.rs (limited to 'src/command/client/sync/register.rs') diff --git a/src/command/client/sync/register.rs b/src/command/client/sync/register.rs deleted file mode 100644 index 6b51fac8..00000000 --- a/src/command/client/sync/register.rs +++ /dev/null @@ -1,49 +0,0 @@ -use clap::Parser; -use eyre::Result; -use tokio::{fs::File, io::AsyncWriteExt}; - -use atuin_client::{api_client, settings::Settings}; - -#[derive(Parser)] -pub struct Cmd { - #[clap(long, short)] - pub username: Option, - - #[clap(long, short)] - pub password: Option, - - #[clap(long, short)] - pub email: Option, -} - -impl Cmd { - pub async fn run(self, settings: &Settings) -> Result<()> { - run(settings, &self.username, &self.email, &self.password).await - } -} - -pub async fn run( - settings: &Settings, - username: &Option, - email: &Option, - password: &Option, -) -> Result<()> { - use super::login::or_user_input; - let username = or_user_input(username, "username"); - let email = or_user_input(email, "email"); - let password = password - .clone() - .unwrap_or_else(super::login::read_user_password); - - let session = - api_client::register(settings.sync_address.as_str(), &username, &email, &password).await?; - - let path = settings.session_path.as_str(); - let mut file = File::create(path).await?; - file.write_all(session.session.as_bytes()).await?; - - // Create a new key, and save it to disk - let _key = atuin_client::encryption::new_key(settings)?; - - Ok(()) -} -- cgit v1.3.1