Skip to main content

CliCommand

Enum CliCommand 

Source
#[non_exhaustive]
pub enum CliCommand {
Show 39 variants GetBrowserInfo, ListWindows, OpenWindow { title_prefix: Option<String>, incognito: bool, }, CloseWindow { window_id: WindowId, }, SetWindowTitlePrefix { window_id: WindowId, prefix: String, }, RemoveWindowTitlePrefix { window_id: WindowId, }, ListTabs { window_id: WindowId, }, OpenTab { window_id: WindowId, insert_before_tab_id: Option<TabId>, insert_after_tab_id: Option<TabId>, url: Option<String>, username: Option<String>, password: Option<Password>, background: bool, cookie_store_id: Option<CookieStoreId>, wait_for_load_timeout_ms: Option<u32>, }, ActivateTab { tab_id: TabId, }, NavigateTab { tab_id: TabId, url: String, }, ReloadTab { tab_id: TabId, bypass_cache: bool, }, CloseTab { tab_id: TabId, }, PinTab { tab_id: TabId, }, UnpinTab { tab_id: TabId, }, ToggleReaderMode { tab_id: TabId, }, DiscardTab { tab_id: TabId, }, WarmupTab { tab_id: TabId, }, MuteTab { tab_id: TabId, }, UnmuteTab { tab_id: TabId, }, MoveTab { tab_id: TabId, new_index: u32, }, GoBack { tab_id: TabId, steps: u32, }, GoForward { tab_id: TabId, steps: u32, }, SubscribeEvents { include_windows_tabs: bool, include_downloads: bool, }, ListContainers, ReopenTabInContainer { tab_id: TabId, cookie_store_id: CookieStoreId, }, ListDownloads { state: Option<DownloadState>, limit: Option<u32>, query: Option<String>, }, StartDownload { url: String, filename: Option<String>, save_as: bool, conflict_action: Option<FilenameConflictAction>, }, CancelDownload { download_id: DownloadId, }, PauseDownload { download_id: DownloadId, }, ResumeDownload { download_id: DownloadId, }, RetryDownload { download_id: DownloadId, }, EraseDownload { download_id: DownloadId, }, EraseAllDownloads { state: Option<DownloadState>, }, ListTabGroups { window_id: Option<WindowId>, }, GetTabGroup { group_id: TabGroupId, }, UpdateTabGroup { group_id: TabGroupId, title: Option<String>, color: Option<TabGroupColor>, collapsed: Option<bool>, }, MoveTabGroup { group_id: TabGroupId, index: u32, window_id: Option<WindowId>, }, GroupTabs { tab_ids: Vec<TabId>, group_id: Option<TabGroupId>, }, UngroupTabs { tab_ids: Vec<TabId>, },
}
Expand description

A command sent from the CLI to the mediator, and forwarded to the extension.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

GetBrowserInfo

Retrieve information about the connected browser instance.

§

ListWindows

List all open windows with their tab summaries.

§

OpenWindow

Open a new browser window.

Fields

§title_prefix: Option<String>

Optional title prefix (Firefox titlePreface) to set on the new window. Firefox-only; returns an error on other browsers when set.

When set, the extension calls browser.windows.update immediately after creation with { titlePreface: title_prefix }.

§incognito: bool

If true, open the window in private/incognito browsing mode.

The extension must be allowed to run in private windows for this to work.

§

CloseWindow

Close an existing browser window.

Fields

§window_id: WindowId

The ID of the window to close.

§

SetWindowTitlePrefix

Set the title prefix (Firefox titlePreface) for a window.

Firefox-only. Returns an error on browsers that do not support titlePreface.

Fields

§window_id: WindowId

The ID of the window whose prefix to set.

§prefix: String

The prefix string to prepend to the window title.

§

RemoveWindowTitlePrefix

Remove the title prefix from a window, restoring the default title.

Firefox-only. Returns an error on browsers that do not support titlePreface.

Fields

§window_id: WindowId

The ID of the window whose prefix to remove.

§

ListTabs

List all tabs in a window with full details.

Fields

§window_id: WindowId

The ID of the window whose tabs to list.

§

OpenTab

Open a new tab in a window.

Fields

§window_id: WindowId

The ID of the window in which to open the tab.

§insert_before_tab_id: Option<TabId>

If set, the new tab will be inserted immediately before the tab with this ID.

§insert_after_tab_id: Option<TabId>

If set, the new tab will be inserted immediately after the tab with this ID.

§url: Option<String>

The URL to load in the new tab, or the browser’s default new-tab page if absent.

§username: Option<String>

Optional username for HTTP authentication.

When set (together with password), the extension opens the URL without embedded credentials and responds to the server’s 401 challenge via the webRequest.onAuthRequired API, injecting the credentials into the browser’s built-in authentication cache. Subsequent requests to the same realm reuse the cached credentials automatically. Requires url to be set.

§password: Option<Password>

Optional password for HTTP authentication.

Used together with username. Requires url to be set.

§background: bool

If true, the new tab is created in the background and the currently active tab in the window remains active.

§cookie_store_id: Option<CookieStoreId>

Firefox container (cookie store) ID to open the tab in. Firefox-only; returns an error on browsers without container support.

E.g. "firefox-container-1".

§wait_for_load_timeout_ms: Option<u32>

Optional timeout in milliseconds to wait for the tab to finish loading before returning.

When set, the extension waits for tabs.onUpdated to report status: "complete" for this tab, up to the given timeout. If the timeout elapses, the tab details are returned in whatever state they are in. When None, the tab details are returned immediately after creation without waiting.

§

ActivateTab

Activate a tab, making it the focused tab in its window.

Fields

§tab_id: TabId

The ID of the tab to activate.

§

NavigateTab

Navigate an existing tab to a new URL.

Fields

§tab_id: TabId

The ID of the tab to navigate.

§url: String

The URL to load in the tab.

§

ReloadTab

Reload a tab.

Fields

§tab_id: TabId

The ID of the tab to reload.

§bypass_cache: bool

If true, bypass the browser cache (hard refresh).

§

CloseTab

Close a tab.

Fields

§tab_id: TabId

The ID of the tab to close.

§

PinTab

Pin a tab.

Fields

§tab_id: TabId

The ID of the tab to pin.

§

UnpinTab

Unpin a tab.

Fields

§tab_id: TabId

The ID of the tab to unpin.

§

ToggleReaderMode

Toggle Reader Mode for a tab.

Firefox-only. Switches the tab into or out of Reader Mode. The tab must be displaying a page that Firefox considers reader-mode compatible.

Fields

§tab_id: TabId

The ID of the tab whose Reader Mode to toggle.

§

DiscardTab

Discard a tab, unloading its content from memory without closing it.

The tab remains in the tab strip but its content is freed. It will be reloaded when activated. Cannot discard the active tab.

Fields

§tab_id: TabId

The ID of the tab to discard.

§

WarmupTab

Warm up a discarded tab, loading its content into memory without activating it.

Firefox-only. Uses tabs.warmup() which is not available on Chrome.

Fields

§tab_id: TabId

The ID of the tab to warm up.

§

MuteTab

Mute a tab, suppressing any audio it produces.

Fields

§tab_id: TabId

The ID of the tab to mute.

§

UnmuteTab

Unmute a tab, allowing it to produce audio again.

Fields

§tab_id: TabId

The ID of the tab to unmute.

§

MoveTab

Move a tab to a new position within its window.

Fields

§tab_id: TabId

The ID of the tab to move.

§new_index: u32

The new zero-based index for the tab within its window.

§

GoBack

Navigate backward in a tab’s session history.

Returns a CliResult::Tab with the details of the page navigated to, or the current tab state if the history boundary was already reached.

Fields

§tab_id: TabId

The ID of the tab to navigate.

§steps: u32

Number of steps to go back (default 1).

§

GoForward

Navigate forward in a tab’s session history.

Returns a CliResult::Tab with the details of the page navigated to, or the current tab state if the history boundary was already reached.

Fields

§tab_id: TabId

The ID of the tab to navigate.

§steps: u32

Number of steps to go forward (default 1).

§

SubscribeEvents

Subscribe to a live stream of browser events.

After sending this command the mediator streams BrowserEvent objects as newline-delimited JSON on the same connection until the client disconnects. No CliResponse is sent; events arrive directly as BrowserEvent JSON.

When both include_windows_tabs and include_downloads are false (the default), all event categories are delivered (backward compatible).

Fields

§include_windows_tabs: bool

Include window and tab events (WindowOpened, WindowClosed, TabOpened, TabClosed, TabActivated, TabNavigated, TabTitleChanged, TabStatusChanged).

§include_downloads: bool

Include download events (DownloadCreated, DownloadChanged, DownloadErased).

§

ListContainers

List all Firefox containers (contextual identities).

Firefox-only. Returns an error on browsers that do not support contextual identities.

§

ReopenTabInContainer

Close a tab and reopen its URL in a different container.

Firefox-only. The tab is closed and a new tab is created in the target container with the same URL.

Fields

§tab_id: TabId

The ID of the tab to reopen.

§cookie_store_id: CookieStoreId

The target container’s cookie store ID.

§

ListDownloads

List downloads, optionally filtered by state.

Fields

§state: Option<DownloadState>

Filter by download state.

§limit: Option<u32>

Maximum number of results to return.

§query: Option<String>

Free-text search query matching URL and filename.

§

StartDownload

Start a new download.

Fields

§url: String

The URL to download.

§filename: Option<String>

Filename relative to the downloads folder.

§save_as: bool

If true, show the Save As dialog.

§conflict_action: Option<FilenameConflictAction>

How to handle filename conflicts.

§

CancelDownload

Cancel an active download.

Fields

§download_id: DownloadId

The download ID to cancel.

§

PauseDownload

Pause an active download.

Fields

§download_id: DownloadId

The download ID to pause.

§

ResumeDownload

Resume a paused download.

Fields

§download_id: DownloadId

The download ID to resume.

§

RetryDownload

Retry an interrupted download by re-downloading from the same URL.

Fields

§download_id: DownloadId

The download ID to retry.

§

EraseDownload

Remove a download from the browser’s download history (the file stays on disk).

Fields

§download_id: DownloadId

The download ID to erase.

§

EraseAllDownloads

Clear all downloads from the browser’s history, optionally filtered by state.

Fields

§state: Option<DownloadState>

Only erase downloads in this state.

§

ListTabGroups

List all tab groups, optionally filtered by window.

Chrome-only. Returns an error on browsers that do not support tab groups.

Fields

§window_id: Option<WindowId>

Only list groups in this window.

§

GetTabGroup

Get a single tab group by ID.

Chrome-only.

Fields

§group_id: TabGroupId

The ID of the group to retrieve.

§

UpdateTabGroup

Update a tab group’s properties.

Chrome-only.

Fields

§group_id: TabGroupId

The ID of the group to update.

§title: Option<String>

New title for the group.

§color: Option<TabGroupColor>

New color for the group.

§collapsed: Option<bool>

New collapsed state for the group.

§

MoveTabGroup

Move a tab group to a new position.

Chrome-only.

Fields

§group_id: TabGroupId

The ID of the group to move.

§index: u32

The new zero-based index for the group.

§window_id: Option<WindowId>

Move the group to a different window.

§

GroupTabs

Add tabs to a tab group, optionally creating a new group.

Chrome-only.

Fields

§tab_ids: Vec<TabId>

The tab IDs to group.

§group_id: Option<TabGroupId>

The group to add the tabs to. If None, a new group is created.

§

UngroupTabs

Remove tabs from their tab groups.

Chrome-only.

Fields

§tab_ids: Vec<TabId>

The tab IDs to ungroup.

Trait Implementations§

Source§

impl Clone for CliCommand

Source§

fn clone(&self) -> CliCommand

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CliCommand

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CliCommand

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for CliCommand

Source§

fn eq(&self, other: &CliCommand) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for CliCommand

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for CliCommand

Source§

impl StructuralPartialEq for CliCommand

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,