mirror of
https://github.com/aramperes/nut-rs.git
synced 2025-09-09 05:28:31 -04:00
version: 0.0.4
feat: parse well-known NUT variables
This commit is contained in:
parent
0ba5e4565f
commit
4456922492
6 changed files with 169 additions and 12 deletions
|
@ -23,15 +23,16 @@ fn main() -> nut_client::Result<()> {
|
|||
|
||||
let mut conn = Connection::new(config)?;
|
||||
|
||||
// Print a list of all UPS devices and their variables
|
||||
// Print a list of all UPS devices
|
||||
println!("Connected UPS devices:");
|
||||
for (name, description) in conn.list_ups()? {
|
||||
println!("\t- Name: {}", name);
|
||||
println!("\t Description: {}", description);
|
||||
println!("\t Variables:");
|
||||
|
||||
for (var_name, var_val) in conn.list_vars(&name)? {
|
||||
println!("\t\t- {} = {}", var_name, var_val);
|
||||
// List UPS variables (key = val)
|
||||
println!("\t Variables:");
|
||||
for var in conn.list_vars(&name)? {
|
||||
println!("\t\t- {}", var);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue