Wakatime
非官方测试版翻译
本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →
功能
显示当前在 wakatime 上记录的当日编码时间
注意
你必须在 wakatime 网站申请 API 密钥。 免费套餐已足够使用,可在个人资料设置页面找到 API 密钥。
示例配置
- json
- yaml
- toml
{
"type": "wakatime",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#007acc",
"options": {
"url": "https://wakatime.com/api/v1/users/current/summaries?start=today&end=today&api_key=API_KEY",
"http_timeout": 500
}
}
type: wakatime
style: powerline
powerline_symbol:
foreground: "#ffffff"
background: "#007acc"
options:
url: https://wakatime.com/api/v1/users/current/summaries?start=today&end=today&api_key=API_KEY
http_timeout: 500
type = "wakatime"
style = "powerline"
powerline_symbol = ""
foreground = "#ffffff"
background = "#007acc"
[options]
url = "https://wakatime.com/api/v1/users/current/summaries?start=today&end=today&api_key=API_KEY"
http_timeout = 500
选项
| Name | Type | Default | Description |
|---|---|---|---|
url | string | The Wakatime summaries URL, including the API key. Example above. | |
http_timeout | int | 20 | The time (in milliseconds, ms) it takes to consider an http request as timed-out. If no segment is shown, try increasing this timeout. |
动态 API 密钥
若不想在配置文件中直接写入 API 密钥,可采用以下替代方案:
- json
- yaml
- toml
{
"options": {
"url": "https://wakatime.com/api/v1/users/current/summaries?start=today&end=today&api_key={{ .Env.WAKATIME_API_KEY }}",
"http_timeout": 500
}
}
options:
url: https://wakatime.com/api/v1/users/current/summaries?start=today&end=today&api_key={{
.Env.WAKATIME_API_KEY }}
http_timeout: 500
[options]
url = "https://wakatime.com/api/v1/users/current/summaries?start=today&end=today&api_key={{ .Env.WAKATIME_API_KEY }}"
http_timeout = 500
备注
WAKATIME_API_KEY 仅为示例名称,任何有效的环境变量名均可使用,只要该变量存在且包含 API 密钥值。
更多信息请参阅环境变量文档。
模板 (信息)
默认模板
{{ secondsRound .CumulativeTotal.Seconds }}
属性
| Name | Type | Description |
|---|---|---|
.CumulativeTotal | wtTotals | object holding total tracked time values |
wtTotals 属性
| Name | Type | Description |
|---|---|---|
.Seconds | float64 | a number representing the total tracked time in seconds |
.Text | string | a string with human readable tracked time (eg: "2 hrs 30 mins") |