mirror of
https://git.alemi.dev/mood.git
synced 2024-11-24 00:54:52 +01:00
feat: allow de-censoring some moods in display
This commit is contained in:
parent
5490a28b75
commit
232d47cdc9
1 changed files with 8 additions and 1 deletions
|
@ -16,11 +16,18 @@ fn main() {
|
||||||
|
|
||||||
probabilities.sort_by_key(|x| x.1);
|
probabilities.sort_by_key(|x| x.1);
|
||||||
|
|
||||||
|
let mut uncensored = Vec::new();
|
||||||
let censored = std::env::args().nth(1).as_deref().unwrap_or("") == "--censored";
|
let censored = std::env::args().nth(1).as_deref().unwrap_or("") == "--censored";
|
||||||
|
|
||||||
|
if censored {
|
||||||
|
for arg in std::env::args().skip(2) {
|
||||||
|
uncensored.push(arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
println!("{{");
|
println!("{{");
|
||||||
for (line, count, chance) in probabilities {
|
for (line, count, chance) in probabilities {
|
||||||
let l = if censored {
|
let l = if censored && !uncensored.iter().any(|x| line.starts_with(x)) {
|
||||||
"■".repeat(line.len())
|
"■".repeat(line.len())
|
||||||
} else {
|
} else {
|
||||||
line.replace('"', "\\\"")
|
line.replace('"', "\\\"")
|
||||||
|
|
Loading…
Reference in a new issue