diff options
-rw-r--r-- | hm/soispha/pkgs/scripts.nix | 12 | ||||
-rw-r--r-- | hm/soispha/pkgs/scripts/wrappers/neorg_id_completion_function | 1 |
2 files changed, 4 insertions, 9 deletions
diff --git a/hm/soispha/pkgs/scripts.nix b/hm/soispha/pkgs/scripts.nix index 1fd9fd3b..0c58d83a 100644 --- a/hm/soispha/pkgs/scripts.nix +++ b/hm/soispha/pkgs/scripts.nix @@ -88,15 +88,9 @@ ALL_PROJECTS_PIPE = "${config.soispha.taskwarrior.projects.projects_pipe}"; ALL_WORKSPACES = "${lib.strings.concatStringsSep "|" (builtins.attrNames config.programs.nixvim.plugins.neorg.modules."core.dirman".config.workspaces)}"; ID_GENERATION_FUNCTION = - # This is here, because escaping the whole function, to use it in the shell script - # directly just isn't possible - pkgs.writeText "ID_GENERATION_FUNCTION" - /* - bash - */ - '' - (wc="$(task "$(con="$(task _get rc.context)"; if [ "$con" ]; then echo "project:$con"; else echo "0-10000"; fi)" _ids)"; if [ "$wc" ]; then echo "$wc"; else echo "0"; fi ) | xargs task _zshids | awk -F: -v s="'" '{print $1 ":" s $2 s}' - ''; + # It's just impossible to correctly quote this function when it's in any language that + # has special treatment for backslashes + ./scripts/wrappers/neorg_id_completion_function; # TODO: Replace the hard-coded path here with some reference <2023-10-20> TASK_PROJECT_FILE = "/home/soispha/repos/nix/nixos-config/hm/soispha/conf/taskwarrior/projects/default.nix"; diff --git a/hm/soispha/pkgs/scripts/wrappers/neorg_id_completion_function b/hm/soispha/pkgs/scripts/wrappers/neorg_id_completion_function new file mode 100644 index 00000000..e9163d2e --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/neorg_id_completion_function @@ -0,0 +1 @@ +(wc="$(task "$(con="$(task _get rc.context)"; if [ "$con" ]; then echo "project:$con"; else echo "0-10000"; fi)" _ids)"; if [ "$wc" ]; then echo "$wc"; else echo "0"; fi ) | xargs task _zshids | awk -F: -v q="'" '{gsub(/'\''/, q "\" q q ); print $1 ":" q $2 q}' |