aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/client/register.rs
diff options
context:
space:
mode:
authorConrad Ludgate <conrad.ludgate@truelayer.com>2022-04-22 21:14:23 +0100
committerGitHub <noreply@github.com>2022-04-22 20:14:23 +0000
commit7436e4ff651b64d4019a59d04c30c414ae220403 (patch)
tree3d5e35df1bce075ae04be63d76f9edc8cc17c6cb /src/command/client/register.rs
parentHistory filter (#329) (diff)
downloadatuin-7436e4ff651b64d4019a59d04c30c414ae220403.zip
feature-flags (#328)
* use feature flags * fmt * fix features * update ci * fmt Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
Diffstat (limited to 'src/command/client/register.rs')
-rw-r--r--src/command/client/register.rs50
1 files changed, 0 insertions, 50 deletions
diff --git a/src/command/client/register.rs b/src/command/client/register.rs
deleted file mode 100644
index 2c60a2e9..00000000
--- a/src/command/client/register.rs
+++ /dev/null
@@ -1,50 +0,0 @@
-use clap::AppSettings;
-use clap::Parser;
-use eyre::Result;
-use tokio::{fs::File, io::AsyncWriteExt};
-
-use atuin_client::api_client;
-use atuin_client::settings::Settings;
-
-#[derive(Parser)]
-#[clap(setting(AppSettings::DeriveDisplayOrder))]
-pub struct Cmd {
- #[clap(long, short)]
- pub username: Option<String>,
-
- #[clap(long, short)]
- pub email: Option<String>,
-
- #[clap(long, short)]
- pub password: Option<String>,
-}
-
-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<String>,
- email: &Option<String>,
- password: &Option<String>,
-) -> Result<()> {
- use super::login::or_user_input;
- let username = or_user_input(username, "username");
- let email = or_user_input(email, "email");
- let password = or_user_input(password, "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(())
-}