mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-13 23:54:48 +01:00
game options
This commit is contained in:
@@ -59,11 +59,19 @@ async fn parse_args(inp: &Vec<String>) -> Result<Args, ArgsError> {
|
|||||||
args.option(
|
args.option(
|
||||||
"H",
|
"H",
|
||||||
"host",
|
"host",
|
||||||
"Host to connect to (eg. 'localhost:443' or 'my.awesomeserver.com:6969)",
|
"Set host to connect to (eg. 'localhost:443' or 'my.awesomeserver.com:6969)",
|
||||||
"SERVER_HOST",
|
"SERVER_HOST",
|
||||||
getopts::Occur::Optional,
|
getopts::Occur::Optional,
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
args.option(
|
||||||
|
"a",
|
||||||
|
"game-args",
|
||||||
|
"Arguments to pass to the game process, if launching it",
|
||||||
|
r#""-opt-one -opt-two"#,
|
||||||
|
getopts::Occur::Optional,
|
||||||
|
None,
|
||||||
|
);
|
||||||
|
|
||||||
args.parse(inp).unwrap();
|
args.parse(inp).unwrap();
|
||||||
|
|
||||||
@@ -76,7 +84,8 @@ async fn parse_args(inp: &Vec<String>) -> Result<Args, ArgsError> {
|
|||||||
|
|
||||||
if args.value_of("launch-game")? {
|
if args.value_of("launch-game")? {
|
||||||
let game_path = config.game_install_path;
|
let game_path = config.game_install_path;
|
||||||
system_helpers::run_program(game_path.to_string(), None)
|
let game_args: String = args.value_of("game-args")?;
|
||||||
|
system_helpers::run_program(game_path.to_string(), Some(game_args))
|
||||||
}
|
}
|
||||||
|
|
||||||
if args.value_of("server")? {
|
if args.value_of("server")? {
|
||||||
|
|||||||
Reference in New Issue
Block a user