diff options
| author | Conrad Ludgate <conrad.ludgate@truelayer.com> | 2022-04-12 23:06:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-12 23:06:19 +0100 |
| commit | a95018cc9039851e707973bc19faf907132ae4f3 (patch) | |
| tree | e135f1da64c5d020f336d437f83a333298861ca0 /src/command | |
| parent | fix env config parsing (#295) (diff) | |
| download | atuin-a95018cc9039851e707973bc19faf907132ae4f3.zip | |
goodbye warp, hello axum (#296)
Diffstat (limited to '')
| -rw-r--r-- | src/command/login.rs | 7 | ||||
| -rw-r--r-- | src/command/mod.rs | 2 | ||||
| -rw-r--r-- | src/command/server.rs | 4 |
3 files changed, 5 insertions, 8 deletions
diff --git a/src/command/login.rs b/src/command/login.rs index fe442bc1..efc9c590 100644 --- a/src/command/login.rs +++ b/src/command/login.rs @@ -1,4 +1,3 @@ -use std::borrow::Cow; use std::io; use atuin_common::api::LoginRequest; @@ -66,10 +65,8 @@ impl Cmd { } } -pub(super) fn or_user_input<'a>(value: &'a Option<String>, name: &'static str) -> Cow<'a, str> { - value - .as_deref() - .map_or_else(|| Cow::Owned(read_user_input(name)), Cow::Borrowed) +pub(super) fn or_user_input(value: &'_ Option<String>, name: &'static str) -> String { + value.clone().unwrap_or_else(|| read_user_input(name)) } fn read_user_input(name: &'static str) -> String { diff --git a/src/command/mod.rs b/src/command/mod.rs index 6873c587..84634211 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -133,7 +133,7 @@ impl AtuinCmd { match self { Self::History(history) => history.run(&client_settings, &mut db).await, Self::Import(import) => import.run(&mut db).await, - Self::Server(server) => server.run(&server_settings).await, + Self::Server(server) => server.run(server_settings).await, Self::Stats(stats) => stats.run(&mut db, &client_settings).await, Self::Init(init) => { init.run(); diff --git a/src/command/server.rs b/src/command/server.rs index 6047e5bf..9d97e928 100644 --- a/src/command/server.rs +++ b/src/command/server.rs @@ -10,7 +10,7 @@ pub enum Cmd { /// Start the server Start { /// The host address to bind - #[clap(long, short)] + #[clap(long)] host: Option<String>, /// The port to bind @@ -20,7 +20,7 @@ pub enum Cmd { } impl Cmd { - pub async fn run(&self, settings: &Settings) -> Result<()> { + pub async fn run(&self, settings: Settings) -> Result<()> { match self { Self::Start { host, port } => { let host = host |
