diff options
| author | metamuffin <metamuffin@disroot.org> | 2024-12-26 13:43:03 +0100 | 
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2024-12-26 13:43:03 +0100 | 
| commit | e73d6273e969f9720b9ce730c3c5825126ae892b (patch) | |
| tree | 386c13a5a582e9593605dcef9b6dab7cf6b15620 /server | |
| parent | 01811610b169a0572417c1493ea606353fd1a327 (diff) | |
| download | hurrycurry-e73d6273e969f9720b9ce730c3c5825126ae892b.tar hurrycurry-e73d6273e969f9720b9ce730c3c5825126ae892b.tar.bz2 hurrycurry-e73d6273e969f9720b9ce730c3c5825126ae892b.tar.zst | |
generalize services and add editor to play menu
Diffstat (limited to 'server')
| -rw-r--r-- | server/editor/src/main.rs | 16 | 
1 files changed, 10 insertions, 6 deletions
| diff --git a/server/editor/src/main.rs b/server/editor/src/main.rs index cd0bdbec..8577aec1 100644 --- a/server/editor/src/main.rs +++ b/server/editor/src/main.rs @@ -16,6 +16,7 @@ use std::{      fs::{File, read_to_string},      io::Write,      net::SocketAddr, +    process::exit,      thread::{sleep, spawn},      time::{Duration, Instant},  }; @@ -23,6 +24,9 @@ use tokio::net::{TcpListener, TcpStream};  #[derive(Parser)]  struct Args { +    /// Print version, then exit +    #[arg(short, long)] +    version: bool,      #[arg(short, long, default_value = "127.0.0.1")]      bind_addr: String,      #[arg(short, long, default_value = "27035")] @@ -36,13 +40,9 @@ pub enum Command {      #[clap(alias = "p")]      Play,      /// Save current map to permanent storage -    Save { -        name: Option<String>, -    }, +    Save { name: Option<String> },      /// Load map from storage -    Load { -        name: Option<String>, -    }, +    Load { name: Option<String> },      /// Teleport to spawnpoint      Spawn {          #[arg(short, long)] @@ -54,6 +54,10 @@ pub enum Command {  async fn main() -> Result<()> {      env_logger::init_from_env("LOG");      let args = Args::parse(); +    if args.version { +        println!("{}", env!("CARGO_PKG_VERSION")); +        exit(0); +    }      let ws_listener = TcpListener::bind((args.bind_addr, args.port)).await?;      let mut ms = None;      loop { | 
