Todowner is a tool that processes .todo files in a given folder recursively, creates backups of these files, and converts them to markdown format.
- Recursively find
.todofiles in a given folder. - Create a backup of the
.todofiles. - Convert
.todofiles to markdown format.
go buildsudo mv todowner /usr/local/bin/todowner
todowner -f=filepath For a single file
todowner Executing the script without arguments, will iterate the current folder recursively and discover all '.todo' files.
The main function performs the following tasks:
-
Find the
.todofiles in a given folder, recursively.- Skips hidden directories.
- Collects the paths of all
.todofiles.
-
Create the backup folder.
- Creates a folder named
todowner_backupto store the backups of the.todofiles.
- Creates a folder named
-
Process each
.todofile.- Creates the full nested filepath inside the backup folder.
- Converts todo sections to markdown headings.
- Converts todo boxes to markdown checkboxes.
- Adds a warning to lines that are not headings and do not start with a dash.
- Non-heading lines should have their nesting levels reduced by the number of levels the containing heading had in the 'todo' format.
- The old format was based on the premise that:
- Headings end with ':'.
- Content starts one indentation level after the heading.
- In markdown, this is not needed, so we also remove one more indentation level in non-heading lines.
-
Delete the original file.