make joinstring argument optional for "player" and "studio" subcommands, and also change some messages in the usage message

This commit is contained in:
hippoz 2021-03-24 19:20:54 +02:00
parent a2225c0a68
commit 4a78eb1b56
No known key found for this signature in database
GPG key ID: 7C52899193467641

View file

@ -12,16 +12,17 @@ fn main() {
.author("hippoz <kindahippoz@gmail.com>")
.about("Simplifies the process of installing and running Roblox on Linux using WINE")
.subcommand(SubCommand::with_name("up")
.about("Installs required software and prepares environment")
.about("Installs required software and prepares environment. You usually only need to run this once per user.")
)
.subcommand(SubCommand::with_name("player")
.about("Runs the game client")
.arg_from_usage("<JOINSTRING> The protocol joinstring")
.about("Runs Roblox Player using the specified joinstring, if no joinstring is provided, it will be ran with no arguments.")
.arg_from_usage("[JOINSTRING] The protocol joinstring")
)
.subcommand(SubCommand::with_name("studio")
.about("Runs the studio")
.arg_from_usage("<JOINSTRING> The protocol joinstring")
.about("Runs Roblox Studio using the specified joinstring, if no joinstring is provided, it will be ran with no arguments.")
.arg_from_usage("[JOINSTRING] The protocol joinstring")
)
.setting(clap::AppSettings::ArgRequiredElseHelp)
.get_matches();
if let Some(_matches) = matches.subcommand_matches("up") {
@ -29,11 +30,11 @@ fn main() {
installctl::deploy_protocol_associations();
winectl::wine_launch(installctl::get_game_launcher_binary(), "".to_string());
} else if let Some(matches) = matches.subcommand_matches("player") {
let joinstring = matches.value_of("JOINSTRING").expect("err: launcher: failed to get joinstring");
let joinstring = matches.value_of("JOINSTRING").unwrap_or("");
println!("info: launching player");
winectl::wine_launch(installctl::get_game_launcher_binary(), joinstring.to_string())
} else if let Some(matches) = matches.subcommand_matches("studio") {
let joinstring = matches.value_of("JOINSTRING").expect("err: launcher: failed to get joinstring");
let joinstring = matches.value_of("JOINSTRING").unwrap_or("");
println!("info: launching studio");
winectl::wine_launch(installctl::get_studio_launcher_binary(), joinstring.to_string())
}