summaryrefslogtreecommitdiff
path: root/src/cmd/list.rs
blob: 40a1910cc093c8421c0a07b4fe15f69e5336e54b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! The `list` sub-command.

use crate::config::Configuration;
use crate::libvirt::{Libvirt, VirtError};

/// The `list` sub-command.
///
/// Return the names of all the virtual machines existing on the
/// libvirt instance.
pub fn list(_config: &Configuration) -> Result<(), VirtError> {
    let libvirt = Libvirt::connect("qemu:///system")?;
    for name in libvirt.names()? {
        println!("{}", name);
    }
    Ok(())
}