neorg-task-sync
syncs all uncompleted todo-entries from your neorg journal to a google task list and vice versa.
It allows you to double-check/complete todos on your mobile phone while commuting.
Alternatively, this workflow allows for noting down todos while away from your computer and still have them appear in the newest neorg journal file.
By default, new tasks are synced to the latest journal entry .
Tasks are synced to the last (optionally first) file you specify on the command line, optionally to a specific section (by default TODO
).
This ensures that the latest journal file receives new remote tasks.
While syncing the your journal is the intended use-case it also allows syncing to any other file.
If configured,
I keep notes via Neorg's journal feature. However, I would also like to add TODOs when I am away from the PC (for example after spontaneous meetings). Furthermore, I like to go through and update older TODOs while commuting. For obvious reasons, Neorg's journaling feature cannot solve this, but Google Tasks does.
Hence, the obvious solution was to write a quick syncer. The required metadata is concealed via treesitter-rules.
Unfortunately, Google does not permit shipping client IDs with open source code. Hence, the installation procedure is:
- Install locally
- Create your own Google project & OAuth token
- Install as
neovim
plugin:
Plug 'obreitwi/neorg-task-sync' " vim-plug
- Navigate to the plugin folder (or clone again to install):
git clone https://github.com/obreitwi/neorg-task-sync.git
cd neorg-task-sync
cargo install --path "$PWD"
# pre-create config folder
mkdir -p ~/.config/neorg-task-sync
- (Register for Google Cloud, if not done already…)
- Create a new Google Project. The name does not matter much since you will only use it for yourself. Alternatively, you can also re-use an existing private project of yours.
- For your project, enable Google Tasks API
- Create a new OAuth 2.0 client. For Application Type, choose "Desktop App" and any name.
- After creation, make sure to download the OAuth client to
~/.config/neorg-task-sync/clientsecret.json
The only required confguration is to set a remote task list.
It can be set interactively via neorg-task-sync config tasklist set
.
Run your first sync via
$ neorg-task-sync <path to your neorg journal folder>
Tip: Set alias nts=neorg-task-sync
for your shell.
neorg-task-sync
can be configured in several ways:
${XDG_CONFIG_HOME}/neorg-task-sync/config.yaml
(defaults to:$HOME/.config/neorg-task-sync-config.yaml
)- by specifing an env variable for each config setting, prefixed with
NEORG_TASK_SYNC_
(e.g.NEORG_TASK_SYNC_TASKLIST
to specify a tasklist) - the only required setting (which tasklist to sync to) can be set interactively via
neorg-task-sync config tasklist set
# clear google tasks older than n days, disabled if not specified
clear_completed_tasks_older_than_days: <disabled>
# ignore the following files when syncing
ignore_filenames: ["index.norg"]
# which google task list to sync to, set via `neorg-task-list config tasklist set`
tasklist: ""
# which section to sync todos to, alternatively they are appended to the file
section_todos: "TODOs"
# section containing todos tha should be done till end-of-day
# these todos will be synced with a same-day due date
section_todos_till_end_of_day: ""
This document contains the help content for the neorg-task-sync
command-line program.
Command Overview:
neorg-task-sync
↴neorg-task-sync auth
↴neorg-task-sync auth login
↴neorg-task-sync config
↴neorg-task-sync config import
↴neorg-task-sync config show
↴neorg-task-sync config tasklist
↴neorg-task-sync generate
↴neorg-task-sync generate help-markdown
↴neorg-task-sync generate completion
↴neorg-task-sync parse
↴neorg-task-sync sync
↴neorg-task-sync tasks
↴
Usage: neorg-task-sync [OPTIONS] <COMMAND>
auth
— Auth related commandsconfig
— Show configgenerate
— Generate completionsparse
— Run a parse action (mainly for debugging)sync
— Sync tasks between local file and google taskstasks
— Check which tasks are defined upstream (mainly for debugging)
-v
,--verbose
— Make output more verbose
Auth related commands
Usage: neorg-task-sync auth <COMMAND>
login
—
Usage: neorg-task-sync auth login
Show config
Usage: neorg-task-sync config <COMMAND>
import
—show
—tasklist
—
Usage: neorg-task-sync config import [OPTIONS] <WHAT>
-
<WHAT>
— what to importPossible values:
client-secret
-f
,--file <FILE>
— Read from file
Usage: neorg-task-sync config show
Usage: neorg-task-sync config tasklist <OPERATION> [VALUE]
-
<OPERATION>
Possible values:
get
: Get current valueset
: Set current valuelist
: List possible values current value
-
<VALUE>
— Value (for set operation)
Generate completions
Usage: neorg-task-sync generate <COMMAND>
help-markdown
— Generate markdown from help messagescompletion
— Copmletion script
Generate markdown from help messages
Usage: neorg-task-sync generate help-markdown
Copmletion script
Usage: neorg-task-sync generate completion <SHELL>
-
<SHELL>
— Shell to generate completions forPossible values:
bash
,elvish
,fish
,powershell
,zsh
Run a parse action (mainly for debugging)
Usage: neorg-task-sync parse [OPTIONS] <TARGET>
<TARGET>
— What to generate
-f
,--force-norg
— Force parsing even if extension does not match
Sync tasks between local file and google tasks
Usage: neorg-task-sync sync [OPTIONS] <FILES_OR_FOLDERS>...
<FILES_OR_FOLDERS>
— Files or folders to sync. New remote tasks will be synced into the last file specified (after sorting)
--fix-missing
-f
,--pull-to-first
— Pull new remote tasks to first file specified, instead-s
,--without-sort
— Do not sort filenames prior to syncing-L
,--without-local
— Do not sync remote google tasks to local todos (neither create nor update status)-R
,--without-remote
— Do not sync local todos to remote google tasks (neither create nor update status)-r
,--without-push
— Do not push local todos to google and create new tasks-l
,--without-pull
— Do not pull remote google tasks and insert them into the todo section
Check which tasks are defined upstream (mainly for debugging)
Usage: neorg-task-sync tasks [OPTIONS]
-j
,--json
— output as json
This document was generated automatically by
clap-markdown
.