Skip to content

Commit

Permalink
Merge pull request #267 from znemoe/cli-password-arg-242
Browse files Browse the repository at this point in the history
Fixed missing password option in cli
  • Loading branch information
AmyrAhmady authored Dec 30, 2024
2 parents a384f55 + 1e4156c commit cb729c4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ struct CliArgs {
#[options(help = "target server port")]
port: Option<i32>,

#[options(help = "target server password")]
password: Option<String>,

#[options(help = "nickname to join server with")]
name: Option<String>,

Expand Down Expand Up @@ -85,6 +88,7 @@ Options:
--help
-h, --host <HOST> Server IP
-p, --port <PORT> Server port
-P, --password <PASSWORD> Server password
-n, --name <NAME> Nickname
-g, --gamepath <GAMEPATH> Game path
",
Expand All @@ -95,6 +99,11 @@ Options:

if args.host.is_some() && args.name.is_some() && args.port.is_some() {
if args.gamepath.is_some() && args.gamepath.as_ref().unwrap().len() > 0 {
let password : String = if args.password.is_some() {
args.password.unwrap()
} else {
"".to_string()
};
let _ = run_samp(
args.name.unwrap().as_str(),
args.host.unwrap().as_str(),
Expand All @@ -106,7 +115,7 @@ Options:
dirs_next::data_local_dir().unwrap().to_str().unwrap()
)
.as_str(),
"",
&password,
)
.await;
info!("Attempted to run the game from command line");
Expand Down

0 comments on commit cb729c4

Please sign in to comment.