mirror of
https://github.com/atuinsh/atuin.git
synced 2025-01-08 15:32:01 +01:00
a21737e2b7
* Switch to Cargo workspaces Breaking things into "client", "server" and "common" makes managing the codebase much easier! client - anything running on a user's machine for adding history server - handles storing/syncing history and running a HTTP server common - request/response API definitions, common utils, etc * Update dockerfile
36 lines
913 B
Rust
36 lines
913 B
Rust
use eyre::Result;
|
|
use structopt::StructOpt;
|
|
|
|
use atuin_server::launch;
|
|
use atuin_server::settings::Settings;
|
|
|
|
#[derive(StructOpt)]
|
|
pub enum Cmd {
|
|
#[structopt(
|
|
about="starts the server",
|
|
aliases=&["s", "st", "sta", "star"],
|
|
)]
|
|
Start {
|
|
#[structopt(about = "specify the host address to bind", long, short)]
|
|
host: Option<String>,
|
|
|
|
#[structopt(about = "specify the port to bind", long, short)]
|
|
port: Option<u16>,
|
|
},
|
|
}
|
|
|
|
impl Cmd {
|
|
pub async fn run(&self, settings: &Settings) -> Result<()> {
|
|
match self {
|
|
Self::Start { host, port } => {
|
|
let host = host
|
|
.as_ref()
|
|
.map_or(settings.host.clone(), std::string::ToString::to_string);
|
|
let port = port.map_or(settings.port, |p| p);
|
|
|
|
launch(settings, host, port).await
|
|
}
|
|
}
|
|
}
|
|
}
|