' shortcuts, including flip-bool

This commit is contained in:
Schrottkatze 2025-03-10 14:22:10 +01:00
parent 4b9a8323e9
commit 870e5ec059
Signed by: schrottkatze
SSH key fingerprint: SHA256:FPOYVeBy3QP20FEM42uWF1Wa/Qhlk+L3S2+Wuau/Auo
5 changed files with 50 additions and 13 deletions

View file

@ -0,0 +1,6 @@
[package]
name = "flip-bool"
version = "0.1.0"
edition = "2021"
[dependencies]

View file

@ -0,0 +1,25 @@
use std::io::{Read, Write};
fn main() {
let mut input = String::new();
let mut stdin = std::io::stdin();
let mut stdout = std::io::stdout();
stdin.read_to_string(&mut input).unwrap();
stdout
.write_all(match input.as_bytes() {
b"true" => b"false",
b"True" => b"False",
b"TRUE" => b"FALSE",
b"false" => b"true",
b"False" => b"True",
b"FALSE" => b"TRUE",
b"1" => b"0",
b"yes" => b"no",
b"0" => b"1",
b"no" => b"yes",
other => other,
})
.unwrap();
}