Mercurial > hg > Members > anatofuz > ie-virsh
changeset 6:08247e54d78d
cargo fmt
author | AnaTofuZ <anatofuz@gmail.com> |
---|---|
date | Tue, 27 Oct 2020 17:17:24 +0900 |
parents | ef1358b993e1 |
children | 07b763b84401 |
files | src/main.rs |
diffstat | 1 files changed, 13 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main.rs Tue Oct 27 17:14:39 2020 +0900 +++ b/src/main.rs Tue Oct 27 17:17:24 2020 +0900 @@ -1,5 +1,5 @@ +use clap::{App, Arg, Clap}; use nix; -use clap::{Arg, App, Clap}; use std::process::Command; #[derive(Clap)] @@ -24,14 +24,12 @@ name: String, } - struct VM { id: u32, name: String, is_vm_running: bool, } - fn main() { let uid = getuid(); let gid = getgid(); @@ -39,12 +37,12 @@ println!("uid: {} gid: {} name: {}", uid, gid, user_name); let matches = App::new("ie-virsh") - .version("1.0") - .author("AnatofuZ <anatofuz@cr.ie.u-ryukyu.ac.jp>") - .about("virsh wrapper for ie members") - .get_matches(); + .version("1.0") + .author("AnatofuZ <anatofuz@cr.ie.u-ryukyu.ac.jp>") + .about("virsh wrapper for ie members") + .get_matches(); - /* + /* let opts: Opts = Opts::parse(); match opts.subcmd { @@ -90,7 +88,7 @@ let virsh_emit_vm_list = virsh_list.filter(|&x| x.contains(user_name)); - let mut vm_list : Vec<VM> = Vec::new(); + let mut vm_list: Vec<VM> = Vec::new(); println!("{}\n{}", info_msg, border_line); for emit_vm in virsh_emit_vm_list { @@ -98,12 +96,15 @@ let vm_status = vm_infos.next().unwrap(); let is_vm_running = if vm_status != "-" { true } else { false }; let name = vm_infos.next().unwrap(); - let vm = VM{ id: 0, is_vm_running: is_vm_running, name: String::from(name)}; + let vm = VM { + id: 0, + is_vm_running: is_vm_running, + name: String::from(name), + }; vm_list.push(vm); } } - fn set_root_id() { let id = 0; match nix::unistd::seteuid(nix::unistd::Uid::from_raw(id)) { @@ -126,7 +127,4 @@ } } - -fn create_new_vm(user_name: &'static str, vm_name: &'static str, debug_kernel:bool) { - -} \ No newline at end of file +fn create_new_vm(user_name: &'static str, vm_name: &'static str, debug_kernel: bool) {}