Crystal implementation of the TODO Or Die! Ruby gem by Justin Searls. Add TODOs in code that ensure you actually do them:
TodoOrCry["fix this", Time.utc(2019, 1, 1)]
def broken_method; end
# => raises TodoOrCry::OverdueError
-
Add the dependency to your
shard.yml
:dependencies: todo_or_cry: github: your-github-user/todo_or_cry
-
Run
shards install
Require TodoOrCry
like this:
require "todo_or_cry"
Then whenever you have a todo item you want to make sure gets done, add a call to TodoOrCry.[]
:
TodoOrCry["fix this", Time.utc(2019, 1, 1)]
Nothing will happen before the due date, but afterwards a TodoOrCry::OverdueError
will be raised:
Unhandled exception: TODO: "fix this" came due on 2019-01-01. Do it! (TodoOrCry::OverdueError)
from foo.cr:4:3 in '__crystal_main'
The error message can be customized with .error_message=
:
TodoOrCry.error_message = "You have failed to do \"%s\" since %s"
# Raises
Unhandled exception: You have failed to do "fix this" since 2019-01-01 (TodoOrCry::OverdueError)
from foo.cr:4:3 in '__crystal_main'
To restore the standard error message, use .default_error_message!
:
TodoOrCry.default_error_message!
- Fork it (https://github.com/citizen428/todo_or_cry/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- Michael Kohl - creator and maintainer