about summary refs log tree commit diff stats
path: root/hm/soispha/pkgs/scripts/wrappers/neorg
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-12-28 13:58:10 +0100
committerSoispha <soispha@vhack.eu>2023-12-28 13:58:10 +0100
commite628885761de443cc2bd4a618ee100e45603bc40 (patch)
tree364c496a74f1cbbfce290617465cb673cdfc9a9f /hm/soispha/pkgs/scripts/wrappers/neorg
parentfeat(hm/pkgs/scr/neorg): Change the active task and context when opening browser (diff)
downloadnixos-config-e628885761de443cc2bd4a618ee100e45603bc40.tar.gz
nixos-config-e628885761de443cc2bd4a618ee100e45603bc40.zip
feat(hm/pkgs/scr/neorg): Add a subcommand to making starting task easier
Diffstat (limited to '')
-rwxr-xr-xhm/soispha/pkgs/scripts/wrappers/neorg20
1 files changed, 20 insertions, 0 deletions
diff --git a/hm/soispha/pkgs/scripts/wrappers/neorg b/hm/soispha/pkgs/scripts/wrappers/neorg
index f11772ae..dda81308 100755
--- a/hm/soispha/pkgs/scripts/wrappers/neorg
+++ b/hm/soispha/pkgs/scripts/wrappers/neorg
@@ -46,6 +46,10 @@ COMMANDS:
 
     add
                             Allows you to quickly add projects
+
+    fstart [ID]
+                            Starts the task (ID) but only after it stooped
+                            the previous active task, if it existed.
 ARGUMENTS:
     ID | *([0-9]) := [[$(cat %ID_GENERATION_FUNCTION)]]
                             The function displays all possible IDs of the eligable tasks.
@@ -208,6 +212,15 @@ ADD_open_taskwarrior_project_file() {
     fi
 }
 # }}}
+# {{{
+FSTART_start_new_task() {
+    task_id="$1";
+    # we provided that only one task may be active
+    active="$(task +ACITVE _ids)";
+    [ "$active" ] && task stop "$active";
+    task start "$task_id"
+}
+# }}}
 
 for arg in "$@"; do
     case "$arg" in
@@ -263,6 +276,13 @@ while [ "$#" -ne 0 ]; do
             DMENU_open_context_in_browser;
             exit 0
             ;;
+        "f"*) # fstart
+            shift 1;
+            task_id="$1";
+            [ "$task_id" ] || die "No task id provided to fstart";
+            FSTART_start_new_task "$task_id";
+            exit 0
+            ;;
         *)
             die "Command '$1' does not exist! Please look at:\n $NAME --help";
             exit 0;