From 7b9e5c6cfcde5a06254c1e85b16ffdcaab205ffa Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sun, 12 May 2024 09:25:21 +0200 Subject: [PATCH] Add `todo` and `til` functions Add helper functions to write text input into a `TODO.txt` or `TIL.txt` file respectively. Extracting this to a function means I'm not able to overwrite the contents of a file by typing `echo "foo" > TODO.txt` or similar accidentally and overwriting the entire file instead of appending to it. --- lib/shared/modules/zsh.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/shared/modules/zsh.nix b/lib/shared/modules/zsh.nix index c104991..0c9c057 100644 --- a/lib/shared/modules/zsh.nix +++ b/lib/shared/modules/zsh.nix @@ -82,6 +82,24 @@ fi } + til() { + if [[ ''${#} < 1 ]]; then + echo "No text was provided." + return + fi + + echo ''${1} >> TIL.txt + } + + todo() { + if [[ ''${#} < 1 ]]; then + echo "No text was provided." + return + fi + + echo ''${1} >> TODO.txt + } + ttyper() { command ${pkgs.ttyper}/bin/ttyper --language english1000 --words 50 "''${@}" }