improve taskwarrior pushover
This commit is contained in:
parent
9a916d6a2c
commit
e367b7882d
1 changed files with 18 additions and 2 deletions
|
@ -46,6 +46,16 @@ in
|
||||||
server = mkOption {
|
server = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
};
|
};
|
||||||
|
tagLimitInTitle = mkOption {
|
||||||
|
type = int;
|
||||||
|
default = 10;
|
||||||
|
description = "tag limit for title, TagsInTitle must be enabled for this to work";
|
||||||
|
};
|
||||||
|
tagsInTitle = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = "should tags be used for titles? (see tagLimitInTitle to limit the amount of tags)";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
@ -77,6 +87,11 @@ in
|
||||||
rc.taskd.server=${cfg.server} \
|
rc.taskd.server=${cfg.server} \
|
||||||
"$@"
|
"$@"
|
||||||
'';
|
'';
|
||||||
|
# tags as title
|
||||||
|
title =
|
||||||
|
if (cfg.tagsInTitle && (cfg.tagLimitInTitle > 0))
|
||||||
|
then ''(.tags | if . == null or . == [] then "taskwarrior" else [limit(${toString cfg.tagLimitInTitle};.[])] | join(",") end)''
|
||||||
|
else ''"taskwarrior"'';
|
||||||
in
|
in
|
||||||
''
|
''
|
||||||
if [ -d /var/lib/${name}/${cfg.dataDir} ]
|
if [ -d /var/lib/${name}/${cfg.dataDir} ]
|
||||||
|
@ -92,10 +107,11 @@ in
|
||||||
| ${pkgs.jq}/bin/jq -r '.[] | @base64' | while read entry
|
| ${pkgs.jq}/bin/jq -r '.[] | @base64' | while read entry
|
||||||
do
|
do
|
||||||
echo $entry | base64 --decode | \
|
echo $entry | base64 --decode | \
|
||||||
${pkgs.jq}/bin/jq '{
|
${pkgs.jq}/bin/jq '
|
||||||
|
{
|
||||||
"token": "'`cat ${cfg.pushoverApiTokenFile}`'",
|
"token": "'`cat ${cfg.pushoverApiTokenFile}`'",
|
||||||
"user": "'`cat ${cfg.pushoverUserKeyFile}`'",
|
"user": "'`cat ${cfg.pushoverUserKeyFile}`'",
|
||||||
"titel": "taskwarrior",
|
title: ${title},
|
||||||
message: .description
|
message: .description
|
||||||
}' \
|
}' \
|
||||||
| ${pkgs.curl}/bin/curl -sS -X POST -H 'Content-Type: application/json' -d @- \
|
| ${pkgs.curl}/bin/curl -sS -X POST -H 'Content-Type: application/json' -d @- \
|
||||||
|
|
Loading…
Reference in a new issue