-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement the remind
command
#68
Conversation
I don't think this has to be its own command, but rather a set of new flags on
`list` (tend to be against config settings). Particularly the porcelain flag
sounds nice to have even for other usage of `list`.
…On Thu, Jan 12, 2017 at 03:21:25PM -0800, Hugo Osvaldo Barrera wrote:
The main idea behind this is to allow external scripts to remind of soon-to-expire tasks, or just allow the user to check if they're up to date on tasks or now.
Some stuff that needs to be defined:
* Do we want `due_in` to be a flag or configuration setting? I'm inclined to make it the latter, though both might be possible.
* Do we want `overdue` to be a flag or configuration setting? Same doubt here.
Pending:
* [ ] Tests:
* Include ones with tz-aware tasks, and tz-naive tasks.
* [ ] A `--porcelain` flag, to keep the format permanently frozen so scripts can parse this easily.
I think it's safe to say that this would close #67
Please, chime in on the functionality (I'll continue polishing the code in the meantime, it's a mere prototype)
You can view, comment on, or merge this pull request online at:
#68
-- Commit Summary --
* Implement the remind command
-- File Changes --
M todoman/cli.py (39)
-- Patch Links --
https://github.com/pimutils/todoman/pull/68.patch
https://github.com/pimutils/todoman/pull/68.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#68
|
Good call. It's also a lot less code than I'd expect. It's a shame that the filtering |
def list(ctx, lists, all, urgent, location, category, grep, sort, reverse): | ||
@click.option('--due', default=None, help='Only show tasks due in DUE hours', | ||
type=int) | ||
# TODO: we might want a `porcelain` flag here to print this is a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JSON seems like the obvious candidate. There are CLI tools dedicated to selecting fields from JSON, for scripting purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking something a bit simpler, like this (due date, percent, title). Basically inspired in git status --porcelain
:
2017-01-01 0 Do stuff
2017-01-01 100 Do more stuff
JSON is nicer for apps to read, but a bit more complex for bash scripts. I guess it depends a bit on who we're targeting with this, but I'd much rather stick to the simplest-possible format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For scripting purposes https://github.com/stedolan/jq can be used, docs at https://stedolan.github.io/jq/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've convinced me; +1 for JSON.
@@ -326,11 +338,23 @@ def list(ctx, lists, all, urgent, location, category, grep, sort, reverse): | |||
(not pattern or ( | |||
pattern.search(todo.summary) or | |||
pattern.search(todo.description) | |||
)) | |||
)) and | |||
( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On all other lines the following style is used:
(a
b)
but here you use:
(
a
b
)
(todo.due <= max_naive)) or | ||
(todo.due and | ||
todo.due.tzinfo and | ||
(todo.due <= max_aware))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is getting out of hand, I think it's time for a new function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I kind of makes me lose faith a bit and just work on #23.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving this into a function is really easy compared to implementing a new cache.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, python does some magic optimizations for this sort of list comprehension, I'd have to see if they still apply here, and if a function has any drawbacks (I admit I'm a bit ignorant on this, and might be mistaken).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd argue that if you care about this, you'd have to rewrite it in a compiled language.
remind
commandremind
command
The main idea behind this is to allow external scripts to remind of soon-to-expire tasks, or just allow the user to check if they're up to date on tasks or now.
Some stuff that needs to be defined:
due_in
to be a flag or configuration setting? I'm inclined to make it the latter, though both might be possible.overdue
to be a flag or configuration setting? Same doubt here.Pending:
--porcelain
flag, to keep the format permanently frozen so scripts can parse this easily.I think it's safe to say that this would close #67
Please, chime in on the functionality (I'll continue polishing the code in the meantime, it's a mere prototype)