Skip to content

Procedural macro that allows checking if host machine supports a given command

License

Notifications You must be signed in to change notification settings

mskrip/has-command-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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()
    );
}

About

Procedural macro that allows checking if host machine supports a given command

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages