2 releases
0.1.1 | Mar 30, 2023 |
---|---|
0.1.0 | Mar 30, 2023 |
#4 in #clamd
11KB
226 lines
clamd-client
example in src/main.rs
extern crate clamd_client;
use anyhow::Result;
use std::env;
fn main() -> Result<()> {
let args = env::args().collect::<Vec<_>>();
let mut clamd = clamd_client::Clamd::new()?;
match args.len() {
2 => {
println!(
"{}",
match &args[1].to_lowercase()[..] {
"ping" => clamd.ping()?,
"version" => clamd.version()?,
"reload" => clamd.reload()?,
"shutdown" => {
clamd.shutdown()?;
String::from("Shutdown succeeded")
}
other => format!("Command not found: {other}"),
}
);
}
3 => {
println!(
"{}",
match &args[1].to_lowercase()[..] {
"scan" => clamd.scan(&args[2])?,
"instream" => clamd.instream_scan(&args[2], None)?,
other => format!("Command not found: {other}"),
}
);
}
_ => {
println!("Usage: {} [ping|version|reload|shutdown|scan|instream] [file]", args[0])
}
}
Ok(())
}
Dependencies
~0.4–0.9MB
~19K SLoC