Skip to main content

parse_target

Function parse_target 

Source
pub fn parse_target(value: &str) -> Result<BrowserTarget>
Expand description

Parse a positional <browser>[/<tab>] argument.

Parse precedence — first match wins:

  1. URL scheme (ws://, wss://, http://, https://) → BrowserSelector::Url, no tab.
  2. Absolute path that exists → BrowserSelector::ExecutablePath, no tab.
  3. Value containing / after position 0 → split on first /: left is parsed as a bare selector, right is validated as a tab name.
  4. Matches a KindBrowserSelector::Kind, no tab.
  5. Otherwise BrowserSelector::Name, no tab.

Backward compat: any value without an embedded / parses identically to parse.