mousetrap

Crates.iomousetrap
lib.rsmousetrap
version0.1.0
sourcesrc
created_at2022-12-23 07:45:15.011257
updated_at2022-12-23 07:45:15.011257
descriptionDetect starting from Windows explorer in Rust
homepagehttps://github.com/iyear/mousetrap-rs
repositoryhttps://github.com/iyear/mousetrap-rs
max_upload_size
id744333
size9,151
iyear (iyear)

documentation

https://docs.rs/mousetrap

README

mousetrap-rs

Rust implementation of https://github.com/inconshreveable/mousetrap

mousetrap is a tiny library that answers a single question.

On a Windows machine, was the process invoked by someone double-clicking on the executable file while browsing in explorer?

mousetrap provides a way to detect these invocations so that you can provide more helpful behavior and instructions on how to run the CLI tool.

On non-Windows platforms, this library always returns false.

Installation

Add this to your Cargo.toml:

[dependencies]
mousetrap = "0.1"

Usage

use std::io;

fn main() {
    println!("started_by_explorer: {}", mousetrap::started_by_explorer());

    println!("Press Enter to exit...");

    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
}

License

MIT

Commit count: 8

cargo fmt