Skip to content

Commit cb729c4

Browse files
authored
Merge pull request #267 from znemoe/cli-password-arg-242
Fixed missing password option in cli
2 parents a384f55 + 1e4156c commit cb729c4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src-tauri/src/main.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ struct CliArgs {
3535
#[options(help = "target server port")]
3636
port: Option<i32>,
3737

38+
#[options(help = "target server password")]
39+
password: Option<String>,
40+
3841
#[options(help = "nickname to join server with")]
3942
name: Option<String>,
4043

@@ -85,6 +88,7 @@ Options:
8588
--help
8689
-h, --host <HOST> Server IP
8790
-p, --port <PORT> Server port
91+
-P, --password <PASSWORD> Server password
8892
-n, --name <NAME> Nickname
8993
-g, --gamepath <GAMEPATH> Game path
9094
",
@@ -95,6 +99,11 @@ Options:
9599

96100
if args.host.is_some() && args.name.is_some() && args.port.is_some() {
97101
if args.gamepath.is_some() && args.gamepath.as_ref().unwrap().len() > 0 {
102+
let password : String = if args.password.is_some() {
103+
args.password.unwrap()
104+
} else {
105+
"".to_string()
106+
};
98107
let _ = run_samp(
99108
args.name.unwrap().as_str(),
100109
args.host.unwrap().as_str(),
@@ -106,7 +115,7 @@ Options:
106115
dirs_next::data_local_dir().unwrap().to_str().unwrap()
107116
)
108117
.as_str(),
109-
"",
118+
&password,
110119
)
111120
.await;
112121
info!("Attempted to run the game from command line");

0 commit comments

Comments
 (0)