summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2019-01-10 20:17:51 +0100
committerlassulus <lassulus@lassul.us>2019-01-10 20:17:51 +0100
commita1d9c22bbd8eff9198f378e9007ddf4cb9ee2e5c (patch)
tree8ff2cfbe16daba5743a1f922d1036124df8a38ec /krebs
parentbbbe09285a95cda654a344e42e1330bd53748936 (diff)
Reaktor plugins: merge task with todo, make task like todo
Diffstat (limited to 'krebs')
-rw-r--r--krebs/2configs/reaktor-krebs.nix6
-rw-r--r--krebs/2configs/reaktor-retiolum.nix6
-rw-r--r--krebs/5pkgs/simple/Reaktor/plugins.nix68
3 files changed, 25 insertions, 55 deletions
diff --git a/krebs/2configs/reaktor-krebs.nix b/krebs/2configs/reaktor-krebs.nix
index dc2838cae..862c9b991 100644
--- a/krebs/2configs/reaktor-krebs.nix
+++ b/krebs/2configs/reaktor-krebs.nix
@@ -14,12 +14,8 @@ with import <stockholm/lib>;
};
plugins = with pkgs.ReaktorPlugins; [
sed-plugin
- task-add
- task-delete
- task-done
- task-list
] ++
- (attrValues (todo "agenda"))
+ (attrValues (task "agenda"))
;
};
krebs.secret.files.nix-serve-key = {
diff --git a/krebs/2configs/reaktor-retiolum.nix b/krebs/2configs/reaktor-retiolum.nix
index 824f59d09..69fc4b202 100644
--- a/krebs/2configs/reaktor-retiolum.nix
+++ b/krebs/2configs/reaktor-retiolum.nix
@@ -10,12 +10,8 @@ with import <stockholm/lib>;
};
plugins = with pkgs.ReaktorPlugins; [
sed-plugin
- task-add
- task-delete
- task-done
- task-list
] ++
- (attrValues (todo "agenda"))
+ (attrValues (task "agenda"))
;
};
}
diff --git a/krebs/5pkgs/simple/Reaktor/plugins.nix b/krebs/5pkgs/simple/Reaktor/plugins.nix
index 6f59ad1de..1b19a1178 100644
--- a/krebs/5pkgs/simple/Reaktor/plugins.nix
+++ b/krebs/5pkgs/simple/Reaktor/plugins.nix
@@ -146,58 +146,36 @@ rec {
'';
});
- taskrcFile = builtins.toFile "taskrc" ''
- confirmation=no
- '';
-
- task-add = buildSimpleReaktorPlugin "task-add" {
- pattern = "^task-add: (?P<args>.*)$$";
- script = pkgs.writeDash "task-add" ''
- ${pkgs.taskwarrior}/bin/task rc:${taskrcFile} add "$*"
- '';
- };
-
- task-list = buildSimpleReaktorPlugin "task-list" {
- pattern = "^task-list";
- script = pkgs.writeDash "task-list" ''
- ${pkgs.taskwarrior}/bin/task rc:${taskrcFile} export | ${pkgs.jq}/bin/jq -r '.[] | select(.id != 0) | "\(.id) \(.description)"'
- '';
- };
-
- task-delete = buildSimpleReaktorPlugin "task-delete" {
- pattern = "^task-delete: (?P<args>.*)$$";
- script = pkgs.writeDash "task-delete" ''
- ${pkgs.taskwarrior}/bin/task rc:${taskrcFile} delete "$*"
- '';
- };
-
- task-done = buildSimpleReaktorPlugin "task-done" {
- pattern = "^task-done: (?P<args>.*)$$";
- script = pkgs.writeDash "task-done" ''
- ${pkgs.taskwarrior}/bin/task rc:${taskrcFile} done "$*"
- '';
- };
-
- todo = name: {
- add = buildSimpleReaktorPlugin "${name}-add" {
+ task = name: let
+ rcFile = builtins.toFile "taskrc" ''
+ confirmation=no
+ '';
+ in {
+ add = buildSimpleReaktorPlugin "${name}-task-add" {
pattern = "^${name}-add: (?P<args>.*)$$";
script = pkgs.writeDash "${name}-add" ''
- echo "$*" >> ${name}-todo
- echo "added ${name} todo"
+ TASKDATA=$HOME/${name} ${pkgs.taskwarrior}/bin/task rc:${rcFile} add "$*"
'';
};
- delete = buildSimpleReaktorPlugin "${name}-delete" {
+
+ list = buildSimpleReaktorPlugin "task-list" {
+ pattern = "^${name}-list";
+ script = pkgs.writeDash "task-list" ''
+ TASKDATA=$HOME/${name} ${pkgs.taskwarrior}/bin/task rc:${rcFile} export | ${pkgs.jq}/bin/jq -r '.[] | select(.id != 0) | "\(.id) \(.description)"'
+ '';
+ };
+
+ delete = buildSimpleReaktorPlugin "task-delete" {
pattern = "^${name}-delete: (?P<args>.*)$$";
- script = pkgs.writeDash "${name}-delete" ''
- ${pkgs.gnugrep}/bin/grep -Fvxe "$*" ${name}-todo > ${name}-todo.tmp
- ${pkgs.coreutils}/bin/mv ${name}-todo.tmp ${name}-todo
- echo "removed ${name} todo: $*"
+ script = pkgs.writeDash "task-delete" ''
+ TASKDATA=$HOME/${name} ${pkgs.taskwarrior}/bin/task rc:${rcFile} delete "$*"
'';
};
- show = buildSimpleReaktorPlugin "${name}-show" {
- pattern = "^${name}-show$";
- script = pkgs.writeDash "${name}-show" ''
- ${pkgs.coreutils}/bin/cat ${name}-todo
+
+ done = buildSimpleReaktorPlugin "task-done" {
+ pattern = "^${name}-done: (?P<args>.*)$$";
+ script = pkgs.writeDash "task-done" ''
+ TASKDATA=$HOME/${name} ${pkgs.taskwarrior}/bin/task rc:${rcFile} done "$*"
'';
};
};