#start #launch #xdg-open

bin+lib open

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

41 stable releases (4 major)

5.1.2 Mar 7, 2024
5.0.2 Feb 28, 2024
5.0.1 Nov 22, 2023
5.0.0 Jun 25, 2023
1.0.2 Feb 28, 2015

#10 in Operating systems

Download history 58852/week @ 2023-11-27 58555/week @ 2023-12-04 57440/week @ 2023-12-11 53913/week @ 2023-12-18 40535/week @ 2023-12-25 50681/week @ 2024-01-01 55805/week @ 2024-01-08 60749/week @ 2024-01-15 57189/week @ 2024-01-22 63319/week @ 2024-01-29 65390/week @ 2024-02-05 64614/week @ 2024-02-12 74842/week @ 2024-02-19 79803/week @ 2024-02-26 85903/week @ 2024-03-04 30711/week @ 2024-03-11

277,407 downloads per month
Used in 375 crates (294 directly)

MIT license

24KB
405 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

~53KB