25 lines
578 B
Rust
25 lines
578 B
Rust
|
use anyhow::Result;
|
||
|
use clap::Clap;
|
||
|
use posixmq::PosixMq;
|
||
|
|
||
|
/// Print information about an existing message queue
|
||
|
#[derive(Clap, Debug)]
|
||
|
pub struct Info {
|
||
|
/// Name of the queue
|
||
|
#[clap(value_name = "QNAME")]
|
||
|
pub queue: String,
|
||
|
}
|
||
|
|
||
|
impl Info {
|
||
|
pub fn run(&self) -> Result<()> {
|
||
|
let attrs = PosixMq::open(&self.queue)?.attributes()?;
|
||
|
|
||
|
println!(
|
||
|
"Message queue: {}, msg_max: {}, msgsize_max: {}, current_messages: {}",
|
||
|
&self.queue, &attrs.capacity, &attrs.max_msg_len, &attrs.current_messages
|
||
|
);
|
||
|
|
||
|
Ok(())
|
||
|
}
|
||
|
}
|