Taskwarrior
非官方测试版翻译
本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →
功能
展示可通过配置命令获取的 Taskwarrior 任务数据。每个命名命令会使用指定参数运行
task 并将原始输出暴露在模板中。
示例配置
- json
- yaml
- toml
{
"type": "taskwarrior",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#193549",
"background": "#ffeb3b",
"template": " {{ range $k, $v := .Commands }}{{ $k }}:{{ $v }} {{ end }}",
"options": {
"commands": {
"due": "+PENDING due.before:tomorrow count",
"scheduled": "+PENDING scheduled.before:tomorrow count",
"waiting": "+WAITING count",
"context": "_get rc.context"
}
}
}
type: taskwarrior
style: powerline
powerline_symbol:
foreground: "#193549"
background: "#ffeb3b"
template: " {{ range $k, $v := .Commands }}{{ $k }}:{{ $v }} {{ end }}"
options:
commands:
due: +PENDING due.before:tomorrow count
scheduled: +PENDING scheduled.before:tomorrow count
waiting: +WAITING count
context: _get rc.context
type = "taskwarrior"
style = "powerline"
powerline_symbol = ""
foreground = "#193549"
background = "#ffeb3b"
template = " {{ range $k, $v := .Commands }}{{ $k }}:{{ $v }} {{ end }}"
[options.commands]
due = "+PENDING due.before:tomorrow count"
scheduled = "+PENDING scheduled.before:tomorrow count"
waiting = "+WAITING count"
context = "_get rc.context"
选项
| Name | Type | Default | Description |
|---|---|---|---|
command | string | task | the Taskwarrior executable to use |
commands | map[string]string | see below | map of name to Taskwarrior arguments; the raw output is exposed in .Commands |
默认 commands 值
{
"due": "+PENDING due.before:tomorrow count",
"scheduled": "+PENDING scheduled.before:tomorrow count",
"waiting": "+WAITING count",
"context": "_get rc.context"
}
每个条目运行 task <arguments> 并将修剪后的标准输出存储为字符串。删除不需要的条目
可保持提示符渲染速度。
模板 (信息)
默认模板
{{ "\uf4a0" }} {{ range $k, $v := .Commands }}{{ $k }}:{{ $v }} {{ end }}
属性
| Name | Type | Description |
|---|---|---|
.Commands | map[string]string | raw command output keyed by name with the first letter uppercased (e.g. "Due") |
示例
直接访问特定命令的结果:
{{ "\uf4a0" }} Due: {{ .Commands.Due }}
展示多个结果:
{{ "\uf4a0" }} Due: {{ .Commands.Due }} | Waiting: {{ .Commands.Waiting }}
在任务计数旁包含活动上下文:
{{ "\uf4a0" }} {{ .Commands.Context }} - Due: {{ .Commands.Due }} Scheduled: {{ .Commands.Scheduled }}