aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorConrad Ludgate <conrad.ludgate@truelayer.com>2022-04-12 23:06:19 +0100
committerGitHub <noreply@github.com>2022-04-12 23:06:19 +0100
commita95018cc9039851e707973bc19faf907132ae4f3 (patch)
treee135f1da64c5d020f336d437f83a333298861ca0 /src
parentfix env config parsing (#295) (diff)
downloadatuin-a95018cc9039851e707973bc19faf907132ae4f3.zip
goodbye warp, hello axum (#296)
Diffstat (limited to 'src')
-rw-r--r--src/command/login.rs7
-rw-r--r--src/command/mod.rs2
-rw-r--r--src/command/server.rs4
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