crabtrap 0.1.0

Detect whether your app was launched from the terminal or from explorer/PowerToys in Windows
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented0 out of 0 items with examples
  • Size
  • Source code size: 21.91 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.13 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 17s Average build duration of successful builds.
  • all releases: 17s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • FrancescoLuzzi/crabtrap
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • FrancescoLuzzi

crabtrap

Rust porting of the golang library mousetrap

This is a tiny crate with a minimal footprint, that solves a simple problem:

Was the binary launched from the terminal or by double clicking on it?

This crate gives an answer in the Windows world, keeping the question open in all other operating systems (suggestions are welcome).

Example

use crabtrap::started_by_explorer;

fn main(){
    if started_by_explorer(){
        println!("I'm from a GUI");
    } else{
        println!("I'm from the terminal");
    }
}