From 1c1b5256b9fb7fb274bd52bb36f25900cad39419 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Sun, 19 Feb 2023 16:53:15 -0800 Subject: [PATCH] todo-txt: init --- hosts/home.nix | 1 + modules/todo-txt/default.nix | 31 +++++++++++++++++++++++++++++++ modules/todo-txt/p.sh | 1 + modules/todo-txt/pri.sh | 12 ++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 modules/todo-txt/default.nix create mode 100755 modules/todo-txt/p.sh create mode 100755 modules/todo-txt/pri.sh diff --git a/hosts/home.nix b/hosts/home.nix index 3f4e7de..feb1704 100644 --- a/hosts/home.nix +++ b/hosts/home.nix @@ -18,6 +18,7 @@ in ../modules/rofi ../modules/startpage ../modules/terminal + ../modules/todo-txt ]; home.file."./.background-image".source = theme.wallpaper; diff --git a/modules/todo-txt/default.nix b/modules/todo-txt/default.nix new file mode 100644 index 0000000..8387ac5 --- /dev/null +++ b/modules/todo-txt/default.nix @@ -0,0 +1,31 @@ +{ pkgs, ... }: + +{ + home = { + packages = with pkgs; [ + todo-txt-cli + #todofi-sh + ]; + file = let + todoDir = ".todo"; + actionsDir = "${todoDir}/actions"; + in { + ".config/todo/config".text = '' + export TODO_DIR=~/${todoDir} + export TODO_ACTIONS_DIR=~/${actionsDir} + ''; + "${actionsDir}/pri" = { + source = ./pri.sh; + executable = true; + }; + "${actionsDir}/p" = { + source = ./p.sh; + executable = true; + }; + }; + }; + programs = { + bash.shellAliases.t = "todo.sh"; + neovim.plugins = with pkgs.vimPlugins; [ todo-txt-vim ]; + }; +} diff --git a/modules/todo-txt/p.sh b/modules/todo-txt/p.sh new file mode 100755 index 0000000..b32510c --- /dev/null +++ b/modules/todo-txt/p.sh @@ -0,0 +1 @@ +todo.sh pri $2 $3 diff --git a/modules/todo-txt/pri.sh b/modules/todo-txt/pri.sh new file mode 100755 index 0000000..ff4f7dd --- /dev/null +++ b/modules/todo-txt/pri.sh @@ -0,0 +1,12 @@ +ITEMS=$2 +PRIORITY=$3 + +if [[ $ITEMS =~ ^([0-9]+)-([0-9]+)$ ]]; then + START=${BASH_REMATCH[1]} + END=${BASH_REMATCH[2]} + for i in $(seq $START $END); do + todo.sh command pri $i $PRIORITY || break + done +else + todo.sh command pri $ITEMS $PRIORITY +fi