| Crates.io | has_command |
| lib.rs | has_command |
| version | 0.1.0 |
| created_at | 2019-10-17 13:53:17.185721+00 |
| updated_at | 2019-10-17 13:53:17.185721+00 |
| description | Allows checking if host machine supports a given command |
| homepage | |
| repository | https://github.com/mskrip/has-command-rs/ |
| max_upload_size | |
| id | 173343 |
| size | 5,354 |
Procedural macro for checking if a host system supports desired command.
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()
);
}