fix(cli): better message when only --headed is ignored in attach mode
In CDP-attach mode (the default since 0.24.0-fork.1), --headed has no effect — the user's existing Chrome is already visible, and the generic "use 'agent-browser close' first to restart" advice doesn't help (the new daemon attaches right back). Explicitly say --headed is moot and point to --launch as the actual escape hatch. Other ignored flags (--profile, --proxy, etc.) keep the existing "close + reopen" message because for those it IS the right advice.
This commit is contained in:
@@ -822,6 +822,18 @@ fn main() {
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
if !ignored_flags.is_empty() && !flags.json {
|
if !ignored_flags.is_empty() && !flags.json {
|
||||||
|
// Special case: --headed is irrelevant in CDP-attach mode
|
||||||
|
// (your existing Chrome is always already visible). The
|
||||||
|
// "agent-browser close + reopen" advice doesn't help because
|
||||||
|
// the new daemon will attach right back to the same Chrome.
|
||||||
|
// Don't suggest a useless workaround.
|
||||||
|
if ignored_flags == ["--headed"] {
|
||||||
|
eprintln!(
|
||||||
|
"{} --headed has no effect when attached to your running Chrome (it's already visible). \
|
||||||
|
Pass --launch to spawn a separate browser if you need to control headedness.",
|
||||||
|
color::warning_indicator(),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"{} {} ignored: daemon already running. Use 'agent-browser close' first to restart with new options.",
|
"{} {} ignored: daemon already running. Use 'agent-browser close' first to restart with new options.",
|
||||||
color::warning_indicator(),
|
color::warning_indicator(),
|
||||||
@@ -829,6 +841,7 @@ fn main() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Validate mutually exclusive options
|
// Validate mutually exclusive options
|
||||||
if flags.cdp.is_some() && flags.provider.is_some() {
|
if flags.cdp.is_some() && flags.provider.is_some() {
|
||||||
|
|||||||
Reference in New Issue
Block a user