#launch #start #xdg-open

bin+lib open

Open a path or URL using the program configured on the system

46 stable releases (4 major)

new 5.3.1 Nov 14, 2024
5.3.0 Jul 10, 2024
5.1.4 Jun 4, 2024
5.1.2 Mar 7, 2024
1.0.2 Feb 28, 2015

#11 in Filesystem

Download history 86311/week @ 2024-07-27 88409/week @ 2024-08-03 92390/week @ 2024-08-10 88258/week @ 2024-08-17 85795/week @ 2024-08-24 101242/week @ 2024-08-31 90002/week @ 2024-09-07 89111/week @ 2024-09-14 96802/week @ 2024-09-21 102363/week @ 2024-09-28 104410/week @ 2024-10-05 100153/week @ 2024-10-12 103486/week @ 2024-10-19 100368/week @ 2024-10-26 94776/week @ 2024-11-02 79776/week @ 2024-11-09

394,282 downloads per month
Used in 489 crates (365 directly)

MIT license

26KB
470 lines

Crates.io cross-platform-testing

Use this library to open a path or URL using the program configured on the system. It is equivalent to running one of the following:

# macOS
$ open <path-or-url>
# Windows
$ start <path-or-url>
# Linux
$ xdg-open <path-or-url> || gio open <path-or-url> || gnome-open <path-or-url> || kde-open <path-or-url> || wslview <path-or-url>

Library Usage

Add this to your Cargo.toml

[dependencies]
open = "5"

…and open something using…

open::that("https://rust-lang.org");

…or, open something with an application of your choice

open::with("https://rust-lang.org", "firefox");

Follow this link for the API docs.

Binary Usage

This crate also implements a binary that acts like an opener itself.

cargo run 'file to open'

Credits

The implementation is based on the respective functionality of Cargo, but was improved to allow some error handling.

Dependencies

~55KB