Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed missing password option in cli #267

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,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 @@ -79,6 +82,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 @@ -89,6 +93,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 @@ -100,7 +109,7 @@ Options:
dirs_next::data_local_dir().unwrap().to_str().unwrap()
)
.as_str(),
"",
&password,
)
.await;
exit(0)
Expand Down