has_command 0.1.0

Allows checking if host machine supports a given command
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented1 out of 1 items with examples
  • Size
  • Source code size: 5.93 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 275.48 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 5s Average build duration of successful builds.
  • all releases: 5s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • mskrip/has-command-rs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • mskrip

has_command

Procedural macro for checking if a host system supports desired command.

Requirements

  • Rust ^1.30

Usage

Add dependency to your Cargo.toml

[dependencies]
has_command = "*"

Add this to your code

use has_command::has_command;

or

#[macro_use]
extern_crate has_command;

Then you can use it as

use std::process::Command;

fn main() {
    run_ls();
}

#[has_command(ls)]
fn run_ls() {
    assert!(Command::new("ls")
        .output()
        .expect("ls should be supported")
        .status
        .success()
    );
}