summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 83d572c..fbe2463 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,3 +1,5 @@
+use std::process::Command;
+
use clap::Parser;
mod errors;
use errors::CliError;
@@ -41,6 +43,9 @@ enum Action {
#[clap(long, short)]
force: bool
+ },
+ View {
+ uuid: String
}
}
@@ -67,6 +72,9 @@ fn main() {
Action::Reboot { uuid, force } => {
reboot(root, client, uuid, force).unwrap();
}
+ Action::View { uuid } => {
+ view(root, uuid).unwrap();
+ }
};
}
@@ -160,3 +168,16 @@ fn reboot(server: String, c: Client, u: String, f: bool) -> Result<(), CliError>
Ok(())
}
+
+fn view(server: String, u: String) -> Result<(), CliError> {
+ let host = server.split(':').next().unwrap();
+ let qemu_url = format!("qemu+ssh://{}/system", host);
+
+ let output = Command::new("virt-viewer")
+ .arg("-c")
+ .arg(qemu_url)
+ .arg(u)
+ .output();
+
+ Ok(())
+}