Skip to content

Instantly share code, notes, and snippets.

@dtomvan
Created October 12, 2024 12:27
Show Gist options
  • Save dtomvan/3d1844d0e008828285181e6e76141b91 to your computer and use it in GitHub Desktop.
Save dtomvan/3d1844d0e008828285181e6e76141b91 to your computer and use it in GitHub Desktop.
Planify converter from JSON backup file to markdown
.projects as $p
| .sections as $s
| .items
| map(select(.completed_at == ""))
| group_by(.project_id)
| map([
"# \(.[0].project_id as $id | $p | map(select(.id == $id))[0].name)",
(group_by(.section_id) |
map(
[
"## \(.[0].section_id as $id | $s | (map(select($id == .id))[0] // {name: "No Section"}).name)",
(map("### \(.content)\n\(.description)\n\n[due::\(.due | fromjson | .date)]") | join("\n\n"))
] | join("\n")
) | join("\n\n")
)] | join("\n")
) | join("\n\n")
#!/usr/bin/env bash
set -euxo pipefail
jq -rf ./planify-json-export.jq "$1" | nvim +'set ft=markdown buftype=nofile'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment