From e6adae81502c3a64a3d9b6ef33507019a43d84fe Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Tue, 29 May 2018 10:18:07 -0700 Subject: [PATCH] migrate deletes sub lines of done items. update README --- README.md | 57 +++++++++++++++++++++++++++++---- mdbj-migrate/2018-05-07-TEST.md | 4 ++- mdbj-migrate/migrate.go | 26 +++++++++++++-- mdbj-migrate/migrate_test.go | 3 +- 4 files changed, 77 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index d634dab..e37c349 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ ![Markdown Bullet Journal Logo](https://github.com/dballard/markdown-bullet-journal/raw/master/Markdown-Bullet-Journal.png "Markdown Bullet Journal Logo") -Markdown Bullet Journal is a digital adaptation of [analog tech](http://bulletjournal.com/). For my personal productivity I found having a full markdown todo list file with daily migrations was the most optimal was to manage my time. I added in a utility to summarize my past work as the daily migrations made that hard to track. +Markdown Bullet Journal is a digital adaptation of [analog tech](http://bulletjournal.com/). When using analog pen + paper, bullet journal migrations are expensive in space and time, however in digital form they are cheap. I found that for my personal productivity having a full markdown todo list file with daily migrations was the most optimal way to manage my time and a digital bullet journal enabled this. I added in a utility to summarize my past work as the daily migrations intentionally removed it. I have also extended this tool to my tastes adding in custom support for repetitive daily tasks and pomodoros. -These are a simple set of utilities that work for me. Nothing fancy +These are a simple set of utilities that work for me. Nothing fancy. ## Usage @@ -15,7 +15,7 @@ Download: - [mdbj-migreate.exe](https://www.danballard.com/resources/mdbj/mdbj-summary.exe) - [mdbj-summary.exe](https://www.danballard.com/resources/mdbj/mdbj-migrate.exe) -And place them in a directory. Run `mdbj-migrate` to generate a template to work from and each day after to 'migrate'. Run `mdbj-summary` to generate summary.txt to review work done. +And place them in a directory you want to use. Run `mdbj-migrate` to generate a template to work from in that directory and each day after to 'migrate' to create the new day's file in that directory. Run `mdbj-summary` to generate summary.txt in the same directory to review work done. ### Linux & Mac @@ -26,7 +26,7 @@ go install github.com/dballard/markdown-bullet-journal/tree/master/mdbj-migrate go install github.com/dballard/markdown-bullet-journal/tree/master/mdbj-summary ``` -Pick a directory you want to use and run `mdbj-migreate` to generate a template to work from. Run it on successive days to 'migrate'. Run `mdbj-summary` to print a summary of done work to the console. +Pick a directory you want to use and run `mdbj-migreate` to generate a template to work from in that directory. Run `mdbj-migrate` on succesive days and it will find the last dated file in the directory and 'migrate' it. Run `mdbj-summary` in the directory to print a summary of all done work to the console. ### Recommendations @@ -36,7 +36,7 @@ My mdbj directoy is in a cloud backed up location so I can also slightly awkward ### mdbj-migrate -When run in a directory, takes the last dated .md file, copies it to a new file with today's date, and dropes all lines marked completed (with a '[x]'). +When run in a directory, takes the last dated .md file, copies it to a new file with today's date, and drops all lines marked completed (with a '[x]'). ### mdbj-summary @@ -77,10 +77,53 @@ These are tasks you might want to do a subset of on any given day, and possibly - [x] 1x5 - minutes of meditation ``` -Will get output as: +under `summary` will show as +``` - 40 pushups - 5 minutes of meditation +``` -And then on migration the '4' and '1' will get reset to 0 and the tasks will not get dropped +And then on `migrate` the '4' and '1' will get reset to 0 and the tasks will not get dropped + +``` +- [ ] 0x10 - Pushups +- [ ] 0x10 - Crunches +- [ ] 0x10 - Lunges +- [ ] 0x5 - minutes of meditation +``` + +#### Pomodoro #### + +If you want to track pomodoro sessions, simply add '.'s inside the square brackets of todo items. They will not be considered done until an 'x' is included and thus will migrate to clean items the next day. They will however count towards pomodoro summaries. + +``` +- [..] Big Task + - [x] Part A + - [x] Part B + - [x] Part C + - [ ] Part D +- [ ] Other Task + - [..x] Thing 1 + - [ ] Thing 2 +``` + +will `migrate` to + +``` +- [ ] Big Task + - [ ] Part D +- [ ] Other Task + - [ ] Thing 2 +``` + +and `summary` will be + +``` + Big Task / Part A + Big Task / Part B + Big Task / Part C + Other Task / Thing 1 +4 / 8 - 4 Pomodoros +``` diff --git a/mdbj-migrate/2018-05-07-TEST.md b/mdbj-migrate/2018-05-07-TEST.md index 31a9871..76542fc 100644 --- a/mdbj-migrate/2018-05-07-TEST.md +++ b/mdbj-migrate/2018-05-07-TEST.md @@ -13,7 +13,9 @@ - [ ] nesting 3 - [ ] nesting 4 - [x] nesting 5 -- [x] not nested + - notes of done thing + - notes of note done thing +- [x] not nested with done notes - asdasd - tabbing diff --git a/mdbj-migrate/migrate.go b/mdbj-migrate/migrate.go index b8dbad5..47d5d12 100644 --- a/mdbj-migrate/migrate.go +++ b/mdbj-migrate/migrate.go @@ -30,6 +30,7 @@ const template = `# Work type processHandler struct { File *os.File + flagStack []process.Flags } func (ph *processHandler) Writeln(line string) { @@ -38,11 +39,30 @@ func (ph *processHandler) Writeln(line string) { // NOP func (ph *processHandler) Eof() {} -func (ph *processHandler) NewFile() {} +func (ph *processHandler) NewFile() { + ph.flagStack = []process.Flags{} +} func (ph *processHandler) ProcessLine(line string, indentLevel int, headerStack []string, lineStack []string, flags process.Flags) { - // TODO: handle [x] numXnum - if !flags.Done || flags.RepTask.Is { + if indentLevel+1 > len(ph.flagStack) { + ph.flagStack = append(ph.flagStack, flags) + } else { + ph.flagStack[indentLevel] = flags + } + + print := true + if !flags.RepTask.Is { // always print repTasks + for i, iflags := range ph.flagStack { + if i > indentLevel { + break + } + if iflags.Done { + print = false + } + } + } + + if print { if flags.RepTask.Is { ph.Writeln(strings.Repeat("\t", indentLevel) + "- [ ] 0x" + strconv.Itoa(flags.RepTask.B) + " " + lineStack[len(lineStack)-1]) } else if flags.Todo { diff --git a/mdbj-migrate/migrate_test.go b/mdbj-migrate/migrate_test.go index 36c9e18..e4fbb8c 100644 --- a/mdbj-migrate/migrate_test.go +++ b/mdbj-migrate/migrate_test.go @@ -22,8 +22,7 @@ const EXPECTED = `# Work - [ ] nesting 2 - [ ] nesting 3 - [ ] nesting 4 - - - asdasd + - notes of note done thing - tabbing - [ ] tabs migrated