nix/scripts/agenda-json.nix

17 lines
716 B
Nix
Raw Permalink Normal View History

2024-04-23 22:00:39 +00:00
{ pkgs }:
pkgs.writeShellScriptBin "agenda-json" ''
~/.config/emacs/bin/doomscript ~/.config/eww/agenda-csv.doomscript | jq -Rsnc '
{"tasks":
[inputs
| . / "\n"
| (.[] | select(length > 0) | . / ",") as $input
| select($input | length > 0 and $input[2] != "" and $input[2] != null)
| {"tags": $input[0], "title": $input[1], "state": $input[3], "time": $input[6], "date": $input[5], "trigger": $input[7]}] }
| {
"tasks": (.tasks[:15]),
"num-total": ( [ .tasks[] | select( .state != "PROJECT" and .state != "" and .state != null)] | length),
"num-tasks": ( [ .tasks[:15][] | select( .state != "PROJECT" and .state != "" and .state != null)] | length)
}' | tr -d '.'
''