Crates.io | open |
lib.rs | open |
version | 5.3.1 |
source | src |
created_at | 2015-02-27 16:30:59.471198 |
updated_at | 2024-11-14 18:20:39.018853 |
description | Open a path or URL using the program configured on the system |
homepage | |
repository | https://github.com/Byron/open-rs |
max_upload_size | |
id | 1490 |
size | 95,998 |
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>
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.
This crate also implements a binary that acts like an opener itself.
cargo run 'file to open'
The implementation is based on the respective functionality of Cargo, but was improved to allow some error handling.