diff --git a/Cargo.lock b/Cargo.lock index 6fa0ed1..eb6bda2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -829,12 +829,12 @@ name = "rkvm-server" version = "0.2.0" dependencies = [ "anyhow", + "clap 4.2.2", "env_logger 0.8.4", "log", "rkvm-input", "rkvm-net", "serde", - "structopt", "tokio", "tokio-native-tls", "toml", diff --git a/rkvm-server/Cargo.toml b/rkvm-server/Cargo.toml index dca4937..ce72e37 100644 --- a/rkvm-server/Cargo.toml +++ b/rkvm-server/Cargo.toml @@ -13,11 +13,11 @@ rkvm-input = { path = "../rkvm-input" } rkvm-net = { path = "../rkvm-net" } serde = { version = "1.0.117", features = ["derive"] } toml = "0.5.7" -structopt = "0.3.20" log = "0.4.11" env_logger = "0.8.1" tokio-native-tls = "0.3.0" anyhow = "1.0.33" +clap = { version = "4.2.2", features = ["derive"] } [package.metadata.rpm] package = "rkvm-server" diff --git a/rkvm-server/src/main.rs b/rkvm-server/src/main.rs index 0b0a14c..2083719 100644 --- a/rkvm-server/src/main.rs +++ b/rkvm-server/src/main.rs @@ -10,7 +10,7 @@ use std::convert::Infallible; use std::net::SocketAddr; use std::path::{Path, PathBuf}; use std::process; -use structopt::StructOpt; +use clap::Parser; use tokio::fs; use tokio::io::{AsyncRead, AsyncWrite}; use tokio::net::TcpListener; @@ -155,18 +155,10 @@ async fn run( } } -#[derive(StructOpt)] +#[derive(Parser)] #[structopt(name = "rkvm-server", about = "The rkvm server application")] struct Args { #[structopt(help = "Path to configuration file")] - #[cfg_attr( - target_os = "linux", - structopt(default_value = "/etc/rkvm/server.toml") - )] - #[cfg_attr( - target_os = "windows", - structopt(default_value = "C:/rkvm/server.toml") - )] config_path: PathBuf, } @@ -177,7 +169,7 @@ async fn main() { .filter(None, LevelFilter::Info) .init(); - let args = Args::from_args(); + let args = Args::parse(); let config = match fs::read_to_string(&args.config_path).await { Ok(config) => config, Err(err) => {