-
Notifications
You must be signed in to change notification settings - Fork 28
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON “API” to allow custom integrations #15
Comments
Awesome idea! Have also been wondering about use-cases for a programmatic API already (JSON or the like). That would allow for some interesting extensions indeed. Cool to know that you’d be potentially interested in this. I’ll keep this ticket open, hit me up whenever you find the time and leisure to do something. |
This topic came up quite a few times now. I think having such an API would be a cool enabler to make klog more hackable and allow people build their own workflows around it, without having to write their own parser and evaluators. I changed the title to reflect the more “generic” nature of this idea. |
I believe that a JSON API would be a good thing. That would help me when I implement a language server for my syntax highlighter (à la vladdeSV/vscode-klog#7). |
Just a sketch how the JSON output could look: Happy path{
"records": [
{
"date": "2020-01-01",
"should_total": "8h!",
"should_total_mins": 480,
"summary": "First day at new #job",
"tags": ["job"],
"total": "7h15m",
"total_mins": 435,
"entries": [
{"type": "range",
"start": "9:00",
"start_midnight_offset_mins": 540,
"end": "17:00",
"end_midnight_offset_mins": 1020,
"summary": null,
"tags": [],
"total_mins": 460},
{"type": "duration",
"time": "-45m",
"time_mins": -45,
"summary": "Lunch break",
"tags": [],
"total_mins": -45}
]
}
],
"errors": null,
} Parsing errors{
"records": null,
"errors": [{
"line": 3,
"column": 0,
"length": 8,
"message": "Malformed date, bla bla bla"
}]
} |
A few thoughts in no particular order:
|
Excellent, thanks for your thoughts! 🎉
|
I’m pretty excited about this idea, so I already got something to work this morning. If someone wants to take a look, I published a pre-release for testing here: https://github.com/jotaen/klog/releases/tag/v1.6-beta1. Just run Instead of I wouldn’t expect major changes anymore, maybe rather a few adjustements or tweaks here and there. So could be ready to go on the weekend or so. |
I’ll close this ticket here, but feel free to open new ones when you find things missing or not working. |
@wAuner, since the inital request was about alfred actually: should you get around to building an alfred extension / workflow, please let me know so I can link it from the docs. I suppose these extensions won’t (or can’t) be part of the klog distributable, but I would love to reference them 😊 |
For macOS there is a great productivity tool called alfred. Once the core functionality of klog has matured, I think it would be cool to add an alfred integration. If I find the time, I‘d be happy to help with that.
All that should be needed would probably be an option that returns the output as json.
This way mac users could call klog from anywhere instantly without opening the terminal.
The text was updated successfully, but these errors were encountered: