get + front file for polybar
This commit is contained in:
parent
dc472a929b
commit
b6b72b4b5b
15
README.org
15
README.org
|
@ -205,6 +205,7 @@ fn set_member(config_path: String, tf_members: &[String]) -> Result<(), &'static
|
||||||
let fronters = get_fronters(&config["pk_key"].as_str().unwrap(), &config["sp_key"].as_str().unwrap(), &system);
|
let fronters = get_fronters(&config["pk_key"].as_str().unwrap(), &config["sp_key"].as_str().unwrap(), &system);
|
||||||
pk_set_fronters(&config["pk_key"].as_str().unwrap(), &system, to_front, &fronters);
|
pk_set_fronters(&config["pk_key"].as_str().unwrap(), &system, to_front, &fronters);
|
||||||
}
|
}
|
||||||
|
get(config_path);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,6 +221,20 @@ fn memberlist(config_path: String) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get(config_path: String) {
|
||||||
|
let config = get_config(&config_path);
|
||||||
|
let sys = get_system(&config_path);
|
||||||
|
|
||||||
|
let f = get_fronters(&config["pk_key"].as_str().unwrap(), &config["sp_key"].as_str().unwrap(), &sys);
|
||||||
|
let mut names = Vec::new();
|
||||||
|
for m in &f["pk"] {
|
||||||
|
names.push(String::from(&m.name));
|
||||||
|
}
|
||||||
|
let fronters = names.join(" || ");
|
||||||
|
println!("Currently fronting: {}", fronters);
|
||||||
|
let _ = fs::write(format!("{}/.front", config_path), fronters);
|
||||||
|
}
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
***** Memberlist
|
***** Memberlist
|
||||||
|
|
|
@ -165,6 +165,7 @@ fn set_member(config_path: String, tf_members: &[String]) -> Result<(), &'static
|
||||||
let fronters = get_fronters(&config["pk_key"].as_str().unwrap(), &config["sp_key"].as_str().unwrap(), &system);
|
let fronters = get_fronters(&config["pk_key"].as_str().unwrap(), &config["sp_key"].as_str().unwrap(), &system);
|
||||||
pk_set_fronters(&config["pk_key"].as_str().unwrap(), &system, to_front, &fronters);
|
pk_set_fronters(&config["pk_key"].as_str().unwrap(), &system, to_front, &fronters);
|
||||||
}
|
}
|
||||||
|
get(config_path);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +191,7 @@ fn get(config_path: String) {
|
||||||
for m in &f["pk"] {
|
for m in &f["pk"] {
|
||||||
names.push(String::from(&m.name));
|
names.push(String::from(&m.name));
|
||||||
}
|
}
|
||||||
let fronters = names.join(" | ");
|
let fronters = names.join(" || ");
|
||||||
println!("Currently fronting: {}", fronters);
|
println!("Currently fronting: {}", fronters);
|
||||||
let _ = fs::write(format!("{}/.front", config_path), fronters);
|
let _ = fs::write(format!("{}/.front", config_path), fronters);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue