fix jrnl not working anymore

This commit is contained in:
Schrottkatze 2024-10-11 08:49:54 +02:00
parent be22d9da42
commit 5c16f2df1b
Signed by: schrottkatze
SSH key fingerprint: SHA256:hXb3t1vINBFCiDCmhRABHX5ocdbLiKyCdKI4HK2Rbbc
4 changed files with 17 additions and 91 deletions

98
Cargo.lock generated
View file

@ -119,17 +119,6 @@ version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi 0.1.19",
"libc",
"winapi 0.3.9",
]
[[package]]
name = "autocfg"
version = "1.2.0"
@ -323,7 +312,7 @@ dependencies = [
"parking_lot",
"signal-hook",
"signal-hook-mio",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -339,7 +328,7 @@ dependencies = [
"parking_lot",
"signal-hook",
"signal-hook-mio",
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -348,7 +337,7 @@ version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b"
dependencies = [
"winapi 0.3.9",
"winapi",
]
[[package]]
@ -541,15 +530,6 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]]
name = "hermit-abi"
version = "0.3.9"
@ -768,16 +748,6 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "kernel32-sys"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
dependencies = [
"winapi 0.2.8",
"winapi-build",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
@ -875,7 +845,7 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec"
dependencies = [
"hermit-abi 0.3.9",
"hermit-abi",
"libc",
"wasi",
"windows-sys 0.52.0",
@ -899,12 +869,6 @@ dependencies = [
"autocfg",
]
[[package]]
name = "numtoa"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"
[[package]]
name = "object"
version = "0.36.4"
@ -950,7 +914,7 @@ checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
dependencies = [
"cfg-if",
"libc",
"redox_syscall 0.4.1",
"redox_syscall",
"smallvec",
"windows-targets 0.48.5",
]
@ -1140,15 +1104,6 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "redox_syscall"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [
"bitflags 1.3.2",
]
[[package]]
name = "redox_syscall"
version = "0.4.1"
@ -1158,12 +1113,6 @@ dependencies = [
"bitflags 1.3.2",
]
[[package]]
name = "redox_termios"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20145670ba436b55d91fc92d25e71160fbfbdd57831631c8d7d36377a476f1cb"
[[package]]
name = "redox_users"
version = "0.4.5"
@ -1539,33 +1488,18 @@ dependencies = [
[[package]]
name = "temp-file"
version = "0.1.8"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f210bda61d003f311d95611d1b68361df8fe8e732c3609f945441bde881321d"
[[package]]
name = "termion"
version = "1.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e"
dependencies = [
"libc",
"numtoa",
"redox_syscall 0.2.16",
"redox_termios",
]
checksum = "b5ff282c3f91797f0acb021f3af7fffa8a78601f0f2fd0a9f79ee7dcf9a9af9e"
[[package]]
name = "termsize"
version = "0.1.6"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e86d824a8e90f342ad3ef4bd51ef7119a9b681b0cc9f8ee7b2852f02ccd2517"
checksum = "6f11ff5c25c172608d5b85e2fb43ee9a6d683a7f4ab7f96ae07b3d8b590368fd"
dependencies = [
"atty",
"kernel32-sys",
"libc",
"termion",
"winapi 0.2.8",
"winapi",
]
[[package]]
@ -1894,12 +1828,6 @@ dependencies = [
"rustls-pki-types",
]
[[package]]
name = "winapi"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
[[package]]
name = "winapi"
version = "0.3.9"
@ -1910,12 +1838,6 @@ dependencies = [
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-build"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"

View file

@ -43,7 +43,6 @@
environment.variables = {
VDPAU_DRIVER = lib.mkIf config.hardware.graphics.enable (lib.mkDefault "va_gl");
S10E_JRNL_FILE_LOC = "/home/jade/Docs/jrnl.md";
};
programs.wireshark.enable = true;

View file

@ -14,5 +14,5 @@ owo-colors = "4.0.0"
petgraph = "0.6.4"
ratatui = "0.26.2"
temp-file = "0.1.8"
termsize = "0.1.6"
termsize = "0.1.9"
inquire = "0.7.5"

View file

@ -7,13 +7,18 @@ pub fn list_entries(path: PathBuf) -> io::Result<()> {
let file = fs::read_to_string(path)?;
if let Some(doc) = Doc::new(&file) {
// TODO: testing, so this shit doesn't blow the fuck up in our face anymore
let termsize::Size { cols, .. } = termsize::get().unwrap();
assert!(cols > 0, "we don't have a terminal width.");
for (i, entry) in doc.entries.into_iter().enumerate() {
let n = format!("{:>2}", i + 1);
let r = format!(". {}", entry.title,);
let l = format!(" {} ", crate::utils::format_datetime(entry.timestamp));
let padding = " ".repeat(cols as usize - (n.len() + r.len() + l.len()));
let fuck_you_debugging = cols as usize - (n.len() + r.chars().count() + l.len());
dbg!(fuck_you_debugging);
let padding = " ".repeat(fuck_you_debugging);
println!("{}{r}{padding}{}", n.cyan(), l.white())
}