Motivation-and-Behaviour / tidyMB

Templates, utilities, and style guides for use in Motivation and Behaviour Research Program
Other
0 stars 0 forks source link

TODO list function interface #10

Closed conig closed 3 years ago

conig commented 4 years ago

@pdparker mentioned that it would be useful to have a function which could extract all comments and assign tasks in a todo list. What platform did you have in mind for the todo list? a plain text list markdown list would be very simple to achieve.

E.g.

# Assignee 1

- [x] Example 1
- [ ] Do something else

# Assignee 2

- [ ] Complete analyses
- [ ] Provide feedback on introduction

I've added a function which can extract comment text out of a rmd:

path <- system.file("tests/test_doc.rmd", package = "tidyMB")
tidyMB::extract_comments(path)
#> [[1]]
#> [1] "Example 1"
#> 
#> [[2]]
#> [1] "|TODO| @James write TODO function (example 2)"
#> 
#> [[3]]
#> [1] "Example 3"

In terms of the interface, the following could work:

<!--|TODO| @{assignee}{todo text}-->

Did you guys have anything in particular in mind?

pdparker commented 4 years ago

Yes that structure would work. Looks great. @tarensanders can you review?

tarensanders commented 3 years ago

Sorry for the late reply, gents. This looks awesome.

conig commented 3 years ago

No worries @tarensanders, got some work done :P

This should be working now. If path is provided it will write the todo to disk. Otherwise it just prints to console (the default).

Putting an X before the todo indicates the task is completed.

<!--|X|TODO| example-->


library(tidyMB)
file <- system.file("tests/test_doc.rmd", package = "tidyMB")
create_todo(file, path = NULL)
#> ### James
#>  - [X] write TODO function (example 2)
#>  - [ ] polish scalp
#> 
#> ### Taren
#>  - [ ] build ASANA API ;)
#> 
#> ### Unassigned
#>  - [X] make todo work with no assignment