launcher: always open GUI unless --no-launcher
This commit is contained in:
parent
94eab89dfc
commit
a7ba9687f0
@ -22,31 +22,7 @@ pub fn maybe_run_launcher(args: &[String]) -> Result<bool> {
|
||||
|
||||
/// Decides when to present the GUI launcher instead of direct session startup.
|
||||
fn should_run_launcher(args: &[String]) -> bool {
|
||||
if args.iter().any(|arg| arg == "--no-launcher") {
|
||||
return false;
|
||||
}
|
||||
if args.iter().any(|arg| arg == "--launcher") {
|
||||
return true;
|
||||
}
|
||||
!has_direct_server_arg(args)
|
||||
}
|
||||
|
||||
/// Detects legacy positional direct-connect invocation (`lesavka-client <url>`).
|
||||
fn has_direct_server_arg(args: &[String]) -> bool {
|
||||
let mut idx = 0usize;
|
||||
while idx < args.len() {
|
||||
let arg = &args[idx];
|
||||
if arg == "--server" {
|
||||
idx = idx.saturating_add(2);
|
||||
continue;
|
||||
}
|
||||
if arg.starts_with("--") {
|
||||
idx += 1;
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
false
|
||||
!args.iter().any(|arg| arg == "--no-launcher")
|
||||
}
|
||||
|
||||
pub fn runtime_env_vars(state: &LauncherState) -> BTreeMap<String, String> {
|
||||
@ -132,8 +108,8 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn maybe_run_launcher_returns_false_without_launcher_flag() {
|
||||
let args = vec!["http://server:50051".to_string()];
|
||||
fn maybe_run_launcher_returns_false_with_explicit_opt_out() {
|
||||
let args = vec!["--no-launcher".to_string()];
|
||||
assert!(!maybe_run_launcher(&args).expect("launcher check"));
|
||||
}
|
||||
|
||||
@ -163,9 +139,9 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_run_launcher_respects_direct_server_args() {
|
||||
fn should_run_launcher_includes_legacy_direct_server_args() {
|
||||
let args = vec!["http://server:50051".to_string()];
|
||||
assert!(!should_run_launcher(&args));
|
||||
assert!(should_run_launcher(&args));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user