From 4a78eb1b5680db35c001b87addb1ca6b41f18a40 Mon Sep 17 00:00:00 2001 From: hippoz Date: Wed, 24 Mar 2021 19:20:54 +0200 Subject: [PATCH] make joinstring argument optional for "player" and "studio" subcommands, and also change some messages in the usage message --- src/main.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 17b49b8..cf9aa7e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,16 +12,17 @@ fn main() { .author("hippoz ") .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(" 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(" 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()) }