update further dependencies

This commit is contained in:
Marcel Märtens 2023-05-04 22:56:40 +02:00
parent 32d8d25124
commit 4be1e82ba9
17 changed files with 212 additions and 172 deletions

174
Cargo.lock generated
View File

@ -130,6 +130,55 @@ dependencies = [
"winapi 0.3.9", "winapi 0.3.9",
] ]
[[package]]
name = "anstream"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"is-terminal",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d"
[[package]]
name = "anstyle-parse"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "anstyle-wincon"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188"
dependencies = [
"anstyle",
"windows-sys 0.48.0",
]
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.71" version = "1.0.71"
@ -296,12 +345,13 @@ checksum = "79d6dc922a2792b006573f60b2648076355daeae5ce9cb59507e5908c9625d31"
[[package]] [[package]]
name = "atomicwrites" name = "atomicwrites"
version = "0.3.1" version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb8f2cd6962fa53c0e2a9d3f97eaa7dbd1e3cbbeeb4745403515b42ae07b3ff6" checksum = "c1163d9d7c51de51a2b79d6df5e8888d11e9df17c752ce4a285fb6ca1580734e"
dependencies = [ dependencies = [
"rustix",
"tempfile", "tempfile",
"winapi 0.3.9", "windows-sys 0.48.0",
] ]
[[package]] [[package]]
@ -583,9 +633,9 @@ dependencies = [
[[package]] [[package]]
name = "censor" name = "censor"
version = "0.2.0" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5563d2728feef9a6186acdd148bccbe850dad63c5ba55a3b3355abc9137cb3eb" checksum = "d41e3b9fdbb9b3edc10dc66a06dc255822f699c432e19403fb966e6d60e0dec4"
dependencies = [ dependencies = [
"once_cell", "once_cell",
] ]
@ -693,49 +743,52 @@ dependencies = [
"atty", "atty",
"bitflags 1.3.2", "bitflags 1.3.2",
"strsim 0.8.0", "strsim 0.8.0",
"textwrap 0.11.0", "textwrap",
"unicode-width", "unicode-width",
"vec_map", "vec_map",
] ]
[[package]] [[package]]
name = "clap" name = "clap"
version = "3.2.25" version = "4.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" checksum = "34d21f9bf1b425d2968943631ec91202fe5e837264063503708b83013f8fc938"
dependencies = [ dependencies = [
"atty", "clap_builder",
"bitflags 1.3.2",
"clap_derive", "clap_derive",
"clap_lex",
"indexmap",
"once_cell", "once_cell",
]
[[package]]
name = "clap_builder"
version = "4.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "914c8c79fb560f238ef6429439a30023c862f7a28e688c58f7203f12b29970bd"
dependencies = [
"anstream",
"anstyle",
"bitflags 1.3.2",
"clap_lex",
"strsim 0.10.0", "strsim 0.10.0",
"termcolor",
"textwrap 0.16.0",
] ]
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "3.2.25" version = "4.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4"
dependencies = [ dependencies = [
"heck 0.4.1", "heck 0.4.1",
"proc-macro-error",
"proc-macro2 1.0.56", "proc-macro2 1.0.56",
"quote 1.0.26", "quote 1.0.26",
"syn 1.0.109", "syn 2.0.15",
] ]
[[package]] [[package]]
name = "clap_lex" name = "clap_lex"
version = "0.2.4" version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1"
dependencies = [
"os_str_bytes",
]
[[package]] [[package]]
name = "clipboard-win" name = "clipboard-win"
@ -853,6 +906,12 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
[[package]]
name = "colorchoice"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]] [[package]]
name = "combine" name = "combine"
version = "4.6.6" version = "4.6.6"
@ -1343,9 +1402,9 @@ dependencies = [
[[package]] [[package]]
name = "crossterm" name = "crossterm"
version = "0.25.0" version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67" checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"crossterm_winapi 0.9.0", "crossterm_winapi 0.9.0",
@ -3099,6 +3158,18 @@ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
[[package]]
name = "is-terminal"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f"
dependencies = [
"hermit-abi 0.3.1",
"io-lifetimes",
"rustix",
"windows-sys 0.48.0",
]
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.10.5" version = "0.10.5"
@ -3570,9 +3641,9 @@ dependencies = [
[[package]] [[package]]
name = "minifb" name = "minifb"
version = "0.23.0" version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9e21c5f89bb820c7878c300c5b944e65de0f1b2a75e0be92ce670b95943740e" checksum = "c66a1fdd7e946fe33fe9725012e25836bba3655769bee9ee347cce7de3f396df"
dependencies = [ dependencies = [
"cc", "cc",
"dlib 0.5.0", "dlib 0.5.0",
@ -3920,18 +3991,6 @@ dependencies = [
"memoffset 0.6.5", "memoffset 0.6.5",
] ]
[[package]]
name = "nix"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4"
dependencies = [
"autocfg",
"bitflags 1.3.2",
"cfg-if 1.0.0",
"libc",
]
[[package]] [[package]]
name = "nix" name = "nix"
version = "0.26.2" version = "0.26.2"
@ -4322,12 +4381,6 @@ dependencies = [
"num-traits", "num-traits",
] ]
[[package]]
name = "os_str_bytes"
version = "6.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267"
[[package]] [[package]]
name = "overload" name = "overload"
version = "0.1.1" version = "0.1.1"
@ -5503,9 +5556,9 @@ checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06"
[[package]] [[package]]
name = "rustyline" name = "rustyline"
version = "10.1.1" version = "11.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1e83c32c3f3c33b08496e0d1df9ea8c64d39adb8eb36a1ebb1440c690697aef" checksum = "5dfc8644681285d1fb67a467fb3021bfea306b99b4146b166a1fe3ada965eece"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"cfg-if 1.0.0", "cfg-if 1.0.0",
@ -5515,7 +5568,7 @@ dependencies = [
"libc", "libc",
"log", "log",
"memchr", "memchr",
"nix 0.25.1", "nix 0.26.2",
"radix_trie", "radix_trie",
"scopeguard", "scopeguard",
"unicode-segmentation", "unicode-segmentation",
@ -6341,12 +6394,6 @@ dependencies = [
"unicode-width", "unicode-width",
] ]
[[package]]
name = "textwrap"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.40" version = "1.0.40"
@ -6913,7 +6960,7 @@ dependencies = [
"async-channel", "async-channel",
"authc", "authc",
"byteorder", "byteorder",
"clap 3.2.25", "clap 4.2.7",
"hashbrown 0.13.2", "hashbrown 0.13.2",
"image", "image",
"num 0.4.0", "num 0.4.0",
@ -6944,7 +6991,7 @@ dependencies = [
name = "veloren-client-i18n" name = "veloren-client-i18n"
version = "0.13.0" version = "0.13.0"
dependencies = [ dependencies = [
"clap 3.2.25", "clap 4.2.7",
"deunicode", "deunicode",
"fluent", "fluent",
"fluent-bundle", "fluent-bundle",
@ -7134,9 +7181,9 @@ dependencies = [
"async-channel", "async-channel",
"async-trait", "async-trait",
"bincode", "bincode",
"bitflags 1.3.2", "bitflags 2.2.1",
"bytes", "bytes",
"clap 3.2.25", "clap 4.2.7",
"criterion", "criterion",
"crossbeam-channel", "crossbeam-channel",
"futures-core", "futures-core",
@ -7191,7 +7238,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"proc-macro2 1.0.56", "proc-macro2 1.0.56",
"quote 1.0.26", "quote 1.0.26",
"syn 1.0.109", "syn 2.0.15",
] ]
[[package]] [[package]]
@ -7305,8 +7352,8 @@ name = "veloren-server-cli"
version = "0.14.0" version = "0.14.0"
dependencies = [ dependencies = [
"cansi", "cansi",
"clap 3.2.25", "clap 4.2.7",
"crossterm 0.25.0", "crossterm 0.26.1",
"lazy_static", "lazy_static",
"mimalloc", "mimalloc",
"num_cpus", "num_cpus",
@ -7336,7 +7383,7 @@ dependencies = [
"bytemuck", "bytemuck",
"chrono", "chrono",
"chumsky", "chumsky",
"clap 3.2.25", "clap 4.2.7",
"cmake", "cmake",
"conrod_core", "conrod_core",
"conrod_winit", "conrod_winit",
@ -7449,7 +7496,7 @@ dependencies = [
"arr_macro", "arr_macro",
"bincode", "bincode",
"bitvec", "bitvec",
"clap 3.2.25", "clap 4.2.7",
"criterion", "criterion",
"csv", "csv",
"deflate", "deflate",
@ -7478,7 +7525,6 @@ dependencies = [
"rstar", "rstar",
"rusqlite", "rusqlite",
"serde", "serde",
"structopt",
"strum", "strum",
"svg_fmt", "svg_fmt",
"tracing", "tracing",

View File

@ -22,7 +22,7 @@ common-net = { package = "veloren-common-net", path = "../common/net" }
network = { package = "veloren-network", path = "../network", features = ["compression","quic"], default-features = false } network = { package = "veloren-network", path = "../network", features = ["compression","quic"], default-features = false }
byteorder = "1.3.2" byteorder = "1.3.2"
tokio = { version = "1.15", default-features = false, features = ["rt-multi-thread"] } tokio = { version = "1.24", default-features = false, features = ["rt-multi-thread"] }
quinn = "0.8" quinn = "0.8"
image = { version = "0.24", default-features = false, features = ["png"] } image = { version = "0.24", default-features = false, features = ["png"] }
num = "0.4" num = "0.4"
@ -41,9 +41,9 @@ voxygen-i18n-helpers = { package = "veloren-voxygen-i18n-helpers", path = "../vo
client-i18n = { package = "veloren-client-i18n", path = "i18n", optional = true } client-i18n = { package = "veloren-client-i18n", path = "i18n", optional = true }
serde = { version = "1.0", features = [ "rc", "derive" ], optional = true } serde = { version = "1.0", features = [ "rc", "derive" ], optional = true }
ron = { version = "0.8", default-features = false, optional = true } ron = { version = "0.8", default-features = false, optional = true }
clap = { version = "3.1.8", optional = true, features = ["color", "std"] } clap = { version = "4.2", optional = true, features = ["color", "std"] }
structopt = { version = "0.3.13", optional = true } structopt = { version = "0.3.13", optional = true }
rustyline = { version = "10.0.0", optional = true } rustyline = { version = "11.0.0", optional = true }
## logging ## logging
termcolor = { version = "1.1", optional = true } termcolor = { version = "1.1", optional = true }
common-frontend = { package = "veloren-common-frontend", path = "../common/frontend", optional = true } common-frontend = { package = "veloren-common-frontend", path = "../common/frontend", optional = true }

View File

@ -21,7 +21,7 @@ hashbrown = { version = "0.13", features = ["serde", "nightly"] }
deunicode = "1.0" deunicode = "1.0"
tracing = "0.1" tracing = "0.1"
# Bin # Bin
clap = { version = "3.1.8", features = ["suggestions", "std"], default-features = false, optional = true } clap = { version = "4.2", features = ["suggestions", "std"], default-features = false, optional = true }
fluent-syntax = { git = "https://github.com/juliancoffee/fluent-rs.git", branch = "patched"} fluent-syntax = { git = "https://github.com/juliancoffee/fluent-rs.git", branch = "patched"}
[[bin]] [[bin]]

View File

@ -19,9 +19,12 @@ fn main() {
let i18n_directory = root.join("assets/voxygen/i18n"); let i18n_directory = root.join("assets/voxygen/i18n");
let reference = ReferenceLanguage::at(&i18n_directory.join(REFERENCE_LANG)); let reference = ReferenceLanguage::at(&i18n_directory.join(REFERENCE_LANG));
let code = args.value_of("CODE").expect("arg is required"); let code = args
.get_one::<String>("CODE")
.expect("arg is required")
.to_string();
let lang = Language { let lang = Language {
code: code.to_owned(), code: code.clone(),
path: root.join(i18n_directory.join(code)), path: root.join(i18n_directory.join(code)),
}; };
let stats = reference.compare_with(&lang); let stats = reference.compare_with(&lang);

View File

@ -26,10 +26,15 @@ impl Tui {
let handle = thread::spawn(move || { let handle = thread::spawn(move || {
thread::sleep(Duration::from_millis(20)); thread::sleep(Duration::from_millis(20));
let mut readline = rustyline::Editor::<()>::new().unwrap(); let mut readline =
rustyline::Editor::<(), rustyline::history::FileHistory>::with_history(
Default::default(),
Default::default(),
)
.unwrap();
while let Ok(cmd) = readline.readline("\n\nbotclient> ") { while let Ok(cmd) = readline.readline("\n\nbotclient> ") {
let keep_going = Self::process_command(&cmd, &mut commands_s); let keep_going = Self::process_command(&cmd, &mut commands_s);
readline.add_history_entry(cmd); readline.add_history_entry(cmd).unwrap();
if !keep_going { if !keep_going {
break; break;
} }
@ -65,22 +70,20 @@ impl Tui {
.args(&[Arg::new("prefix").required(true)]), .args(&[Arg::new("prefix").required(true)]),
) )
.try_get_matches_from(cmd.split(' ')); .try_get_matches_from(cmd.split(' '));
use clap::ErrorKind::*; use clap::error::ErrorKind::*;
match matches { match matches {
Ok(matches) => { Ok(matches) => {
if match matches.subcommand() { if match matches.subcommand() {
Some(("register", matches)) => command_s.try_send(Cmd::Register { Some(("register", matches)) => command_s.try_send(Cmd::Register {
prefix: matches.value_of("prefix").unwrap().to_string(), prefix: matches.get_one::<String>("prefix").unwrap().to_string(),
password: matches.value_of("password").unwrap().to_string(), password: matches.get_one::<String>("password").unwrap().to_string(),
count: matches count: matches.get_one::<usize>("count").cloned(),
.value_of("count")
.and_then(|x| x.parse::<usize>().ok()),
}), }),
Some(("login", matches)) => command_s.try_send(Cmd::Login { Some(("login", matches)) => command_s.try_send(Cmd::Login {
prefix: matches.value_of("prefix").unwrap().to_string(), prefix: matches.get_one::<String>("prefix").unwrap().to_string(),
}), }),
Some(("ingame", matches)) => command_s.try_send(Cmd::InGame { Some(("ingame", matches)) => command_s.try_send(Cmd::InGame {
prefix: matches.value_of("prefix").unwrap().to_string(), prefix: matches.get_one::<String>("prefix").unwrap().to_string(),
}), }),
_ => Ok(()), _ => Ok(()),
} }

View File

@ -24,7 +24,7 @@ serde = { version = "1.0" }
socket2 = "0.5.2" socket2 = "0.5.2"
#sending #sending
crossbeam-channel = "0.5" crossbeam-channel = "0.5"
tokio = { version = "1.15", default-features = false, features = ["io-util", "macros", "rt", "net", "time"] } tokio = { version = "1.24", default-features = false, features = ["io-util", "macros", "rt", "net", "time"] }
tokio-stream = { version = "0.1.2", default-features = false } tokio-stream = { version = "0.1.2", default-features = false }
#tracing and metrics #tracing and metrics
tracing = { version = "0.1", default-features = false, features = ["attributes"]} tracing = { version = "0.1", default-features = false, features = ["attributes"]}
@ -40,7 +40,7 @@ rand = { version = "0.8" }
quinn = { version = "0.8", optional = true } quinn = { version = "0.8", optional = true }
rustls = "0.20.1" rustls = "0.20.1"
#stream flags #stream flags
bitflags = "1.2.1" bitflags = "2.2.1"
lz-fear = { version = "0.1.1", optional = true } lz-fear = { version = "0.1.1", optional = true }
# async traits # async traits
async-trait = "0.1.42" async-trait = "0.1.42"
@ -50,9 +50,9 @@ hashbrown = { version = "0.13" }
[dev-dependencies] [dev-dependencies]
tracing-subscriber = { version = "0.3.7", default-features = false, features = ["env-filter", "fmt", "time", "ansi", "smallvec"] } tracing-subscriber = { version = "0.3.7", default-features = false, features = ["env-filter", "fmt", "time", "ansi", "smallvec"] }
tokio = { version = "1.15", default-features = false, features = ["io-std", "fs", "rt-multi-thread"] } tokio = { version = "1.24", default-features = false, features = ["io-std", "fs", "rt-multi-thread"] }
futures-util = { version = "0.3.7", default-features = false, features = ["sink", "std"] } futures-util = { version = "0.3.7", default-features = false, features = ["sink", "std"] }
clap = { version = "3.1.8", default-features = false, features = ["std", "color", "suggestions"] } clap = { version = "4.2", default-features = false, features = ["std", "color", "suggestions"] }
shellexpand = "3.1.0" shellexpand = "3.1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
prometheus-hyper = "0.1.2" prometheus-hyper = "0.1.2"

View File

@ -22,8 +22,7 @@ fn main() {
Arg::new("mode") Arg::new("mode")
.short('m') .short('m')
.long("mode") .long("mode")
.takes_value(true) .value_parser(["server", "client", "both"])
.possible_values(["server", "client", "both"])
.default_value("both") .default_value("both")
.help( .help(
"choose whether you want to start the server or client or both needed for \ "choose whether you want to start the server or client or both needed for \
@ -34,23 +33,20 @@ fn main() {
Arg::new("port") Arg::new("port")
.short('p') .short('p')
.long("port") .long("port")
.takes_value(true)
.default_value("52000") .default_value("52000")
.help("port to listen on"), .help("port to listen on"),
) )
.arg( .arg(
Arg::new("ip") Arg::new("ip")
.long("ip") .long("ip")
.takes_value(true)
.default_value("127.0.0.1") .default_value("127.0.0.1")
.help("ip to listen and connect to"), .help("ip to listen and connect to"),
) )
.arg( .arg(
Arg::new("protocol") Arg::new("protocol")
.long("protocol") .long("protocol")
.takes_value(true)
.default_value("tcp") .default_value("tcp")
.possible_values(["tcp", "upd", "mpsc"]) .value_parser(["tcp", "upd", "mpsc"])
.help( .help(
"underlying protocol used for this test, mpsc can only combined with mode=both", "underlying protocol used for this test, mpsc can only combined with mode=both",
), ),
@ -59,23 +55,22 @@ fn main() {
Arg::new("trace") Arg::new("trace")
.short('t') .short('t')
.long("trace") .long("trace")
.takes_value(true)
.default_value("warn") .default_value("warn")
.possible_values(["trace", "debug", "info", "warn", "error"]) .value_parser(["trace", "debug", "info", "warn", "error"])
.help("set trace level, not this has a performance impact!"), .help("set trace level, not this has a performance impact!"),
) )
.get_matches(); .get_matches();
let trace = matches.value_of("trace").unwrap(); let trace = matches.get_one::<String>("trace").unwrap();
let filter = EnvFilter::from_default_env().add_directive(trace.parse().unwrap()); let filter = EnvFilter::from_default_env().add_directive(trace.parse().unwrap());
tracing_subscriber::FmtSubscriber::builder() tracing_subscriber::FmtSubscriber::builder()
.with_max_level(Level::TRACE) .with_max_level(Level::TRACE)
.with_env_filter(filter) .with_env_filter(filter)
.init(); .init();
let port: u16 = matches.value_of("port").unwrap().parse().unwrap(); let port = matches.get_one::<u16>("port").unwrap();
let ip: &str = matches.value_of("ip").unwrap(); let ip: &str = matches.get_one::<String>("ip").unwrap();
let addresses = match matches.value_of("protocol") { let addresses = match matches.get_one::<String>("protocol").map(|s| s.as_str()) {
Some("tcp") => ( Some("tcp") => (
ListenAddr::Tcp(format!("{}:{}", ip, port).parse().unwrap()), ListenAddr::Tcp(format!("{}:{}", ip, port).parse().unwrap()),
ConnectAddr::Tcp(format!("{}:{}", ip, port).parse().unwrap()), ConnectAddr::Tcp(format!("{}:{}", ip, port).parse().unwrap()),
@ -88,7 +83,7 @@ fn main() {
}; };
let mut background = None; let mut background = None;
match matches.value_of("mode") { match matches.get_one::<String>("mode").map(|s| s.as_str()) {
Some("server") => server(addresses.0), Some("server") => server(addresses.0),
Some("client") => client(addresses.1), Some("client") => client(addresses.1),
Some("both") => { Some("both") => {

View File

@ -24,22 +24,21 @@ fn main() {
Arg::new("port") Arg::new("port")
.short('p') .short('p')
.long("port") .long("port")
.takes_value(true)
.default_value("15006") .default_value("15006")
.value_parser(clap::value_parser!(u16))
.help("port to listen on"), .help("port to listen on"),
) )
.arg( .arg(
Arg::new("trace") Arg::new("trace")
.short('t') .short('t')
.long("trace") .long("trace")
.takes_value(true)
.default_value("warn") .default_value("warn")
.possible_values(["trace", "debug", "info", "warn", "error"]) .value_parser(["trace", "debug", "info", "warn", "error"])
.help("set trace level, not this has a performance impact!"), .help("set trace level, not this has a performance impact!"),
) )
.get_matches(); .get_matches();
let trace = matches.value_of("trace").unwrap(); let trace = matches.get_one::<String>("trace").unwrap();
let filter = EnvFilter::from_default_env() let filter = EnvFilter::from_default_env()
.add_directive(trace.parse().unwrap()) .add_directive(trace.parse().unwrap())
.add_directive("fileshare::server=trace".parse().unwrap()) .add_directive("fileshare::server=trace".parse().unwrap())
@ -49,7 +48,7 @@ fn main() {
.with_env_filter(filter) .with_env_filter(filter)
.init(); .init();
let port: u16 = matches.value_of("port").unwrap().parse().unwrap(); let port = matches.get_one::<u32>("port").unwrap();
let address = ListenAddr::Tcp(format!("{}:{}", "127.0.0.1", port).parse().unwrap()); let address = ListenAddr::Tcp(format!("{}:{}", "127.0.0.1", port).parse().unwrap());
let runtime = Arc::new(Runtime::new().unwrap()); let runtime = Arc::new(Runtime::new().unwrap());
@ -70,7 +69,7 @@ fn file_exists(file: &str) -> Result<(), String> {
} }
} }
fn get_options<'a>() -> Command<'a> { fn get_options() -> Command {
Command::new("") Command::new("")
.no_binary_name(true) .no_binary_name(true)
.subcommand_required(true) .subcommand_required(true)
@ -87,10 +86,7 @@ fn get_options<'a>() -> Command<'a> {
Arg::new("ip:port") Arg::new("ip:port")
.help("ip and port to connect to, example '127.0.0.1:1231'") .help("ip and port to connect to, example '127.0.0.1:1231'")
.required(true) .required(true)
.validator(|ipport| match ipport.parse::<std::net::SocketAddr>() { .value_parser(clap::value_parser!(std::net::SocketAddr)),
Ok(_) => Ok(()),
Err(e) => Err(format!("must be valid Ip:Port combination {:?}", e)),
}),
), ),
) )
.subcommand(Command::new("list").about("lists all available files on the network")) .subcommand(Command::new("list").about("lists all available files on the network"))
@ -101,7 +97,7 @@ fn get_options<'a>() -> Command<'a> {
Arg::new("file") Arg::new("file")
.help("file to serve") .help("file to serve")
.required(true) .required(true)
.validator(file_exists), .value_parser(file_exists),
), ),
) )
.subcommand( .subcommand(
@ -115,10 +111,7 @@ fn get_options<'a>() -> Command<'a> {
Arg::new("id") Arg::new("id")
.help("id to download. get the id from the `list` command") .help("id to download. get the id from the `list` command")
.required(true) .required(true)
.validator(|id| match id.parse::<u32>() { .value_parser(clap::value_parser!(u32)),
Ok(_) => Ok(()),
Err(e) => Err(format!("must be a number {:?}", e)),
}),
) )
.arg(Arg::new("file").help("local path to store the file to")), .arg(Arg::new("file").help("local path to store the file to")),
) )
@ -156,7 +149,7 @@ async fn client(cmd_sender: mpsc::UnboundedSender<LocalCommand>) {
}, },
Some(("connect", connect_matches)) => { Some(("connect", connect_matches)) => {
let socketaddr = connect_matches let socketaddr = connect_matches
.value_of("ip:port") .get_one::<String>("ip:port")
.unwrap() .unwrap()
.parse() .parse()
.unwrap(); .unwrap();
@ -172,7 +165,7 @@ async fn client(cmd_sender: mpsc::UnboundedSender<LocalCommand>) {
.unwrap(); .unwrap();
}, },
Some(("serve", serve_matches)) => { Some(("serve", serve_matches)) => {
let path = shellexpand::tilde(serve_matches.value_of("file").unwrap()); let path = shellexpand::tilde(serve_matches.get_one::<String>("file").unwrap());
let path: PathBuf = path.parse().unwrap(); let path: PathBuf = path.parse().unwrap();
if let Some(fileinfo) = FileInfo::new(&path).await { if let Some(fileinfo) = FileInfo::new(&path).await {
cmd_sender.send(LocalCommand::Serve(fileinfo)).unwrap(); cmd_sender.send(LocalCommand::Serve(fileinfo)).unwrap();
@ -182,8 +175,8 @@ async fn client(cmd_sender: mpsc::UnboundedSender<LocalCommand>) {
cmd_sender.send(LocalCommand::List).unwrap(); cmd_sender.send(LocalCommand::List).unwrap();
}, },
Some(("get", get_matches)) => { Some(("get", get_matches)) => {
let id: u32 = get_matches.value_of("id").unwrap().parse().unwrap(); let id = *get_matches.get_one::<u32>("id").unwrap();
let file = get_matches.value_of("file"); let file = get_matches.get_one::<String>("file");
cmd_sender cmd_sender
.send(LocalCommand::Get(id, file.map(|s| s.to_string()))) .send(LocalCommand::Get(id, file.map(|s| s.to_string())))
.unwrap(); .unwrap();

View File

@ -35,8 +35,7 @@ fn main() {
Arg::new("mode") Arg::new("mode")
.short('m') .short('m')
.long("mode") .long("mode")
.takes_value(true) .value_parser(["server", "client", "both"])
.possible_values(["server", "client", "both"])
.default_value("both") .default_value("both")
.help( .help(
"choose whether you want to start the server or client or both needed for \ "choose whether you want to start the server or client or both needed for \
@ -47,23 +46,21 @@ fn main() {
Arg::new("port") Arg::new("port")
.short('p') .short('p')
.long("port") .long("port")
.takes_value(true)
.default_value("52000") .default_value("52000")
.value_parser(clap::value_parser!(u16))
.help("port to listen on"), .help("port to listen on"),
) )
.arg( .arg(
Arg::new("ip") Arg::new("ip")
.long("ip") .long("ip")
.takes_value(true)
.default_value("127.0.0.1") .default_value("127.0.0.1")
.help("ip to listen and connect to"), .help("ip to listen and connect to"),
) )
.arg( .arg(
Arg::new("protocol") Arg::new("protocol")
.long("protocol") .long("protocol")
.takes_value(true)
.default_value("tcp") .default_value("tcp")
.possible_values(["tcp", "udp", "mpsc"]) .value_parser(["tcp", "udp", "mpsc"])
.help( .help(
"underlying protocol used for this test, mpsc can only combined with mode=both", "underlying protocol used for this test, mpsc can only combined with mode=both",
), ),
@ -72,14 +69,13 @@ fn main() {
Arg::new("trace") Arg::new("trace")
.short('t') .short('t')
.long("trace") .long("trace")
.takes_value(true)
.default_value("warn") .default_value("warn")
.possible_values(["trace", "debug", "info", "warn", "error"]) .value_parser(["trace", "debug", "info", "warn", "error"])
.help("set trace level, not this has a performance impact!"), .help("set trace level, not this has a performance impact!"),
) )
.get_matches(); .get_matches();
let trace = matches.value_of("trace").unwrap(); let trace = matches.get_one::<String>("trace").unwrap();
let filter = EnvFilter::from_default_env() let filter = EnvFilter::from_default_env()
.add_directive(trace.parse().unwrap()) .add_directive(trace.parse().unwrap())
.add_directive("network_speed=debug".parse().unwrap()) .add_directive("network_speed=debug".parse().unwrap())
@ -94,9 +90,9 @@ fn main() {
.with_env_filter(filter) .with_env_filter(filter)
.init(); .init();
let port: u16 = matches.value_of("port").unwrap().parse().unwrap(); let port = matches.get_one::<u16>("port").unwrap();
let ip: &str = matches.value_of("ip").unwrap(); let ip: &str = matches.get_one::<String>("ip").unwrap();
let addresses = match matches.value_of("protocol") { let addresses = match matches.get_one::<String>("protocol").map(|s| s.as_str()) {
Some("tcp") => ( Some("tcp") => (
ListenAddr::Tcp(format!("{}:{}", ip, port).parse().unwrap()), ListenAddr::Tcp(format!("{}:{}", ip, port).parse().unwrap()),
ConnectAddr::Tcp(format!("{}:{}", ip, port).parse().unwrap()), ConnectAddr::Tcp(format!("{}:{}", ip, port).parse().unwrap()),
@ -110,7 +106,7 @@ fn main() {
let mut background = None; let mut background = None;
let runtime = Arc::new(Runtime::new().unwrap()); let runtime = Arc::new(Runtime::new().unwrap());
match matches.value_of("mode") { match matches.get_one::<String>("mode").map(|s| s.as_str()) {
Some("server") => server(addresses.0, Arc::clone(&runtime)), Some("server") => server(addresses.0, Arc::clone(&runtime)),
Some("client") => client(addresses.1, Arc::clone(&runtime)), Some("client") => client(addresses.1, Arc::clone(&runtime)),
Some("both") => { Some("both") => {

View File

@ -28,7 +28,7 @@ hashbrown = { version = "0.13" }
[dev-dependencies] [dev-dependencies]
async-channel = "1.5.1" async-channel = "1.5.1"
tokio = { version = "1.15", default-features = false, features = ["rt", "macros"] } tokio = { version = "1.24", default-features = false, features = ["rt", "macros"] }
criterion = { version = "0.3.4", features = ["default", "async_tokio"] } criterion = { version = "0.3.4", features = ["default", "async_tokio"] }
[[bench]] [[bench]]

View File

@ -11,5 +11,5 @@ proc-macro = true
[dependencies] [dependencies]
proc-macro2 = "1.0.24" proc-macro2 = "1.0.24"
syn = { version = "1.0.54", features = ["full","extra-traits"]} syn = { version = "2", features = ["full","extra-traits"]}
quote = "1.0.7" quote = "1.0.7"

View File

@ -35,11 +35,11 @@ common-net = { package = "veloren-common-net", path = "../common/net" }
common-frontend = { package = "veloren-common-frontend", path = "../common/frontend" } common-frontend = { package = "veloren-common-frontend", path = "../common/frontend" }
world = { package = "veloren-world", path = "../world", optional = true } world = { package = "veloren-world", path = "../world", optional = true }
tokio = { version = "1.15", default-features = false, features = ["rt-multi-thread"] } tokio = { version = "1.24", default-features = false, features = ["rt-multi-thread"] }
num_cpus = "1.0" num_cpus = "1.0"
cansi = "2.2.1" cansi = "2.2.1"
clap = { version = "3.1.8", features = ["derive"] } clap = { version = "4.2", features = ["derive"] }
crossterm = "0.25" crossterm = "0.26"
lazy_static = "1" lazy_static = "1"
signal-hook = "0.3.6" signal-hook = "0.3.6"
shell-words = "1.0.0" shell-words = "1.0.0"

View File

@ -1,17 +1,17 @@
use clap::StructOpt; use clap::Parser;
use common::comp; use common::comp;
use server::persistence::SqlLogMode; use server::persistence::SqlLogMode;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use tracing::error; use tracing::error;
#[derive(Clone, Debug, StructOpt)] #[derive(Clone, Debug, Parser)]
pub enum Admin { pub enum Admin {
/// Adds an admin /// Adds an admin
Add { Add {
/// Name of the admin to whom to assign a role /// Name of the admin to whom to assign a role
username: String, username: String,
/// role to assign to the admin /// role to assign to the admin
#[structopt(possible_values = comp::AdminRole::variants(), ignore_case = true)] #[arg(ignore_case = true, value_parser = SqlLogMode::variants())]
role: comp::AdminRole, role: comp::AdminRole,
}, },
Remove { Remove {
@ -20,7 +20,7 @@ pub enum Admin {
}, },
} }
#[derive(Clone, Debug, StructOpt)] #[derive(Clone, Debug, Parser)]
pub enum Shutdown { pub enum Shutdown {
/// Closes the server immediately /// Closes the server immediately
Immediate, Immediate,
@ -28,7 +28,7 @@ pub enum Shutdown {
Graceful { Graceful {
/// Number of seconds to wait before shutting down /// Number of seconds to wait before shutting down
seconds: u64, seconds: u64,
#[structopt(short, long, default_value = "The server is shutting down")] #[arg(short, long, default_value = "The server is shutting down")]
/// Shutdown reason /// Shutdown reason
reason: String, reason: String,
}, },
@ -36,22 +36,22 @@ pub enum Shutdown {
Cancel, Cancel,
} }
#[derive(Clone, Debug, StructOpt)] #[derive(Clone, Debug, Parser)]
pub enum SharedCommand { pub enum SharedCommand {
/// Perform operations on the admin list /// Perform operations on the admin list
Admin { Admin {
#[structopt(subcommand)] #[command(subcommand)]
command: Admin, command: Admin,
}, },
} }
#[derive(Debug, Clone, StructOpt)] #[derive(Debug, Clone, Parser)]
pub enum Message { pub enum Message {
#[structopt(flatten)] #[command(flatten)]
Shared(SharedCommand), Shared(SharedCommand),
/// Shut down the server (or cancel a shut down) /// Shut down the server (or cancel a shut down)
Shutdown { Shutdown {
#[structopt(subcommand)] #[command(subcommand)]
command: Shutdown, command: Shutdown,
}, },
/// Loads up the chunks at map center and adds a entity that mimics a /// Loads up the chunks at map center and adds a entity that mimics a
@ -62,15 +62,15 @@ pub enum Message {
}, },
/// Enable or disable sql logging /// Enable or disable sql logging
SqlLogMode { SqlLogMode {
#[structopt(default_value_t, possible_values = SqlLogMode::variants())] #[arg(default_value_t, value_parser = SqlLogMode::variants())]
mode: SqlLogMode, mode: SqlLogMode,
}, },
/// Disconnects all connected clients /// Disconnects all connected clients
DisconnectAllClients, DisconnectAllClients,
} }
#[derive(StructOpt)] #[derive(Parser)]
#[structopt( #[command(
name = "Veloren server TUI", name = "Veloren server TUI",
version = common::util::DISPLAY_VERSION_LONG.as_str(), version = common::util::DISPLAY_VERSION_LONG.as_str(),
about = "The veloren server tui allows sending commands directly to the running server.", about = "The veloren server tui allows sending commands directly to the running server.",
@ -78,41 +78,41 @@ pub enum Message {
)] )]
#[clap(no_binary_name = true)] #[clap(no_binary_name = true)]
pub struct TuiApp { pub struct TuiApp {
#[structopt(subcommand)] #[command(subcommand)]
command: Message, command: Message,
} }
#[derive(StructOpt)] #[derive(Parser)]
pub enum ArgvCommand { pub enum ArgvCommand {
#[structopt(flatten)] #[command(flatten)]
Shared(SharedCommand), Shared(SharedCommand),
} }
#[derive(StructOpt)] #[derive(Parser)]
#[structopt( #[command(
name = "Veloren server CLI", name = "Veloren server CLI",
version = common::util::DISPLAY_VERSION_LONG.as_str(), version = common::util::DISPLAY_VERSION_LONG.as_str(),
about = "The veloren server cli provides an easy to use interface to start a veloren server.", about = "The veloren server cli provides an easy to use interface to start a veloren server.",
author = "The veloren devs <https://gitlab.com/veloren/veloren>", author = "The veloren devs <https://gitlab.com/veloren/veloren>",
)] )]
pub struct ArgvApp { pub struct ArgvApp {
#[structopt(long, short)] #[arg(long, short)]
/// Enables the tui /// Enables the tui
pub tui: bool, pub tui: bool,
#[structopt(long, short)] #[arg(long, short)]
/// Doesn't listen on STDIN /// Doesn't listen on STDIN
/// ///
/// Useful if you want to send the server in background, and your kernels /// Useful if you want to send the server in background, and your kernels
/// terminal driver will send SIGTTIN to it otherwise. (https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Redirections) and you dont want to use `stty -tostop` /// terminal driver will send SIGTTIN to it otherwise. (https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Redirections) and you dont want to use `stty -tostop`
/// or `nohub` or `tmux` or `screen` or `<<< \"\\004\"` to the program. /// or `nohub` or `tmux` or `screen` or `<<< \"\\004\"` to the program.
pub non_interactive: bool, pub non_interactive: bool,
#[structopt(long)] #[arg(long)]
/// Run without auth enabled /// Run without auth enabled
pub no_auth: bool, pub no_auth: bool,
#[structopt(default_value_t, long, short, possible_values = SqlLogMode::variants())] #[arg(default_value_t, long, short, value_parser = SqlLogMode::variants())]
/// Enables SQL logging /// Enables SQL logging
pub sql_log_mode: SqlLogMode, pub sql_log_mode: SqlLogMode,
#[structopt(subcommand)] #[command(subcommand)]
pub command: Option<ArgvCommand>, pub command: Option<ArgvCommand>,
} }

View File

@ -38,12 +38,12 @@ num_cpus = "1.0"
tracing = "0.1" tracing = "0.1"
vek = { version = "0.15.8", features = ["serde"] } vek = { version = "0.15.8", features = ["serde"] }
futures-util = "0.3.7" futures-util = "0.3.7"
tokio = { version = "1.15", default-features = false, features = ["rt"] } tokio = { version = "1.24", default-features = false, features = ["rt"] }
prometheus-hyper = "0.1.4" prometheus-hyper = "0.1.4"
quinn = "0.8" quinn = "0.8"
rustls = { version = "0.20", default-features = false } rustls = { version = "0.20", default-features = false }
rustls-pemfile = { version = "1", default-features = false } rustls-pemfile = { version = "1", default-features = false }
atomicwrites = "0.3.0" atomicwrites = "0.4"
chrono = { version = "0.4.22", features = ["serde"] } chrono = { version = "0.4.22", features = ["serde"] }
chrono-tz = { version = "0.8", features = ["serde"] } chrono-tz = { version = "0.8", features = ["serde"] }
drop_guard = { version = "0.3.0" } drop_guard = { version = "0.3.0" }
@ -66,7 +66,7 @@ rand_distr = "0.4.0"
enumset = "1.0.8" enumset = "1.0.8"
enum-map = "2.4" enum-map = "2.4"
noise = { version = "0.7", default-features = false } noise = { version = "0.7", default-features = false }
censor = "0.2" censor = "0.3"
rusqlite = { version = "0.28.0", features = ["array", "vtab", "bundled", "trace"] } rusqlite = { version = "0.28.0", features = ["array", "vtab", "bundled", "trace"] }
refinery = { version = "0.8.8", features = ["rusqlite"] } refinery = { version = "0.8.8", features = ["rusqlite"] }

View File

@ -96,7 +96,7 @@ gilrs = {version = "0.10.0", features = ["serde-serialize"]}
server = { package = "veloren-server", path = "../server", optional = true, default-features = false, features = ["worldgen"] } server = { package = "veloren-server", path = "../server", optional = true, default-features = false, features = ["worldgen"] }
# CLI # CLI
clap = { version = "3.2.20", features = ["derive"] } clap = { version = "4.2", features = ["derive"] }
# Utility # Utility
assets_manager = {version = "0.10", features = ["ab_glyph"]} assets_manager = {version = "0.10", features = ["ab_glyph"]}
@ -130,7 +130,7 @@ slab = "0.4.2"
strum = { version = "0.24", features = ["derive"] } strum = { version = "0.24", features = ["derive"] }
tracing = "0.1" tracing = "0.1"
treeculler = "0.2" treeculler = "0.2"
tokio = { version = "1.15", default-features = false, features = ["rt-multi-thread"] } tokio = { version = "1.24", default-features = false, features = ["rt-multi-thread"] }
num_cpus = "1.0" num_cpus = "1.0"
inline_tweak = "1.0.2" inline_tweak = "1.0.2"
itertools = "0.10.0" itertools = "0.10.0"

View File

@ -50,7 +50,7 @@ flate2 = { version = "1.0.20", optional = true }
num-traits = { version = "0.2", optional = true } num-traits = { version = "0.2", optional = true }
fallible-iterator = { version = "0.2.0", optional = true } fallible-iterator = { version = "0.2.0", optional = true }
rstar = { version = "0.10", optional = true } rstar = { version = "0.10", optional = true }
clap = { version = "3.1.8", optional = true } clap = { version = "4.2", optional = true }
[dev-dependencies] [dev-dependencies]
@ -58,10 +58,9 @@ common-frontend = { package = "veloren-common-frontend", path = "../common/front
criterion = "0.3" criterion = "0.3"
csv = "1.1.3" csv = "1.1.3"
tracing-subscriber = { version = "0.3.7", default-features = false, features = ["fmt", "time", "ansi", "smallvec", "env-filter"] } tracing-subscriber = { version = "0.3.7", default-features = false, features = ["fmt", "time", "ansi", "smallvec", "env-filter"] }
minifb = "0.23" minifb = "0.24"
rusqlite = { version = "0.28.0", features = ["array", "vtab", "bundled", "trace"] } rusqlite = { version = "0.28.0", features = ["array", "vtab", "bundled", "trace"] }
svg_fmt = "0.4" svg_fmt = "0.4"
structopt = "0.3"
strum = "0.24" strum = "0.24"
[[bench]] [[bench]]

View File

@ -254,8 +254,8 @@ fn main() -> Result<(), Box<dyn Error>> {
Arg::new("database") Arg::new("database")
.required(true) .required(true)
.help("File to generate/resume generation"), .help("File to generate/resume generation"),
Arg::new("ymin").long("ymin").takes_value(true), Arg::new("ymin").long("ymin"),
Arg::new("ymax").long("ymax").takes_value(true), Arg::new("ymax").long("ymax"),
]), ]),
) )
.subcommand( .subcommand(
@ -267,14 +267,19 @@ fn main() -> Result<(), Box<dyn Error>> {
let matches = app.clone().get_matches(); let matches = app.clone().get_matches();
match matches.subcommand() { match matches.subcommand() {
Some(("generate", matches)) => { Some(("generate", matches)) => {
let db_path = matches.value_of("database").expect("database is required"); let db_path = matches
let ymin = matches.value_of("ymin").and_then(|x| i32::from_str(x).ok()); .get_one::<String>("database")
let ymax = matches.value_of("ymax").and_then(|x| i32::from_str(x).ok()); .expect("database is required");
let ymin = matches.get_one::<i32>("ymin").cloned();
let ymax = matches.get_one::<i32>("ymax").cloned();
generate(db_path, ymin, ymax)?; generate(db_path, ymin, ymax)?;
}, },
Some(("palette", matches)) => { Some(("palette", matches)) => {
let conn = let conn = Connection::open(
Connection::open(matches.value_of("database").expect("database is required"))?; matches
.get_one::<String>("database")
.expect("database is required"),
)?;
palette(conn)?; palette(conn)?;
}, },
_ => { _ => {