Reaktor plugins: merge task with todo, make task like todo
This commit is contained in:
parent
bbbe09285a
commit
a1d9c22bbd
@ -14,12 +14,8 @@ with import <stockholm/lib>;
|
|||||||
};
|
};
|
||||||
plugins = with pkgs.ReaktorPlugins; [
|
plugins = with pkgs.ReaktorPlugins; [
|
||||||
sed-plugin
|
sed-plugin
|
||||||
task-add
|
|
||||||
task-delete
|
|
||||||
task-done
|
|
||||||
task-list
|
|
||||||
] ++
|
] ++
|
||||||
(attrValues (todo "agenda"))
|
(attrValues (task "agenda"))
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
krebs.secret.files.nix-serve-key = {
|
krebs.secret.files.nix-serve-key = {
|
||||||
|
@ -10,12 +10,8 @@ with import <stockholm/lib>;
|
|||||||
};
|
};
|
||||||
plugins = with pkgs.ReaktorPlugins; [
|
plugins = with pkgs.ReaktorPlugins; [
|
||||||
sed-plugin
|
sed-plugin
|
||||||
task-add
|
|
||||||
task-delete
|
|
||||||
task-done
|
|
||||||
task-list
|
|
||||||
] ++
|
] ++
|
||||||
(attrValues (todo "agenda"))
|
(attrValues (task "agenda"))
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -146,58 +146,36 @@ rec {
|
|||||||
'';
|
'';
|
||||||
});
|
});
|
||||||
|
|
||||||
taskrcFile = builtins.toFile "taskrc" ''
|
task = name: let
|
||||||
|
rcFile = builtins.toFile "taskrc" ''
|
||||||
confirmation=no
|
confirmation=no
|
||||||
'';
|
'';
|
||||||
|
in {
|
||||||
task-add = buildSimpleReaktorPlugin "task-add" {
|
add = buildSimpleReaktorPlugin "${name}-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" {
|
|
||||||
pattern = "^${name}-add: (?P<args>.*)$$";
|
pattern = "^${name}-add: (?P<args>.*)$$";
|
||||||
script = pkgs.writeDash "${name}-add" ''
|
script = pkgs.writeDash "${name}-add" ''
|
||||||
echo "$*" >> ${name}-todo
|
TASKDATA=$HOME/${name} ${pkgs.taskwarrior}/bin/task rc:${rcFile} add "$*"
|
||||||
echo "added ${name} todo"
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
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>.*)$$";
|
pattern = "^${name}-delete: (?P<args>.*)$$";
|
||||||
script = pkgs.writeDash "${name}-delete" ''
|
script = pkgs.writeDash "task-delete" ''
|
||||||
${pkgs.gnugrep}/bin/grep -Fvxe "$*" ${name}-todo > ${name}-todo.tmp
|
TASKDATA=$HOME/${name} ${pkgs.taskwarrior}/bin/task rc:${rcFile} delete "$*"
|
||||||
${pkgs.coreutils}/bin/mv ${name}-todo.tmp ${name}-todo
|
|
||||||
echo "removed ${name} todo: $*"
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
show = buildSimpleReaktorPlugin "${name}-show" {
|
|
||||||
pattern = "^${name}-show$";
|
done = buildSimpleReaktorPlugin "task-done" {
|
||||||
script = pkgs.writeDash "${name}-show" ''
|
pattern = "^${name}-done: (?P<args>.*)$$";
|
||||||
${pkgs.coreutils}/bin/cat ${name}-todo
|
script = pkgs.writeDash "task-done" ''
|
||||||
|
TASKDATA=$HOME/${name} ${pkgs.taskwarrior}/bin/task rc:${rcFile} done "$*"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user