Skip to content
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

modules/todo enhancements #1100

Merged
merged 15 commits into from
Sep 3, 2021
Merged

modules/todo enhancements #1100

merged 15 commits into from
Sep 3, 2021

Conversation

tadeaspaule
Copy link
Contributor

@tadeaspaule tadeaspaule commented Aug 24, 2021

Hi,

I find the todo module to be really useful, but it was missing some functionality so added it here:

  • can move item to front of the list with Ctrl+F
  • can move item to back of the list with Ctrl+L
  • can set in yaml config whether new items are put as first or last with newPos field (valid values "first" or "last")
  • can set in yaml config whether checked items are shown first or last or not specially resorted with checkedPos field (valid values "first", "last", "none")

Also date functionality:

  • can specify date of todo with various prefixes, for example "in 3 days do this", "08-31 do something on the 31st of Aug", "tomorrow do X", "next week do Y"
  • list is sorted according to dates, with undated todos counting as 7 days from today by default (changable by dates.undatedAsDays setting)
  • can turn this whole functionality on/off with dates.enabled (true by default)
  • can choose various formats with dates.format setting (yyyy-mm-dd, yy-mm-dd, dd-mm-yy, dd-mm-yyyy, dd M yy, dd M yyyy)
  • can hide year if it's current year with dates.hideYearIfCurrent (true by default)
  • can set how when dates flip to showing "in X days" instead of the date stamp with dates.switchToInDaysIn (default 7)

2021-08-31-092930_687x370_scrot

@senorprogrammer
Copy link
Collaborator

Awesome! I’m on vacation right now but as soon as I’m back I’ll merge this in.

@tadeaspaule
Copy link
Contributor Author

Wonderful, hope you have a nice vacation :)

@tadeaspaule tadeaspaule changed the title move items to first or last, new items can be put last modules/todo enhancements Aug 24, 2021
@tadeaspaule
Copy link
Contributor Author

Updated with one more configuration: can set the placement of checked items, so instead of shown at the end (this is still the default), you can use checkedPos in yml to also specify first if you want them to be shown first, or none (or anything else really) to not let checked status affect list sorting.

I find this really useful when you want to use the todo module as a quasi-Kanban board, I use checked items to indicate "in-progress", and want them to be shown (& moved to) the top of the list

switch settings.dateFormat {
case "yyyy-mm-dd", "yy-mm-dd", "dd-mm-yyyy", "dd-mm-yy", "dd M yy", "dd M yyyy":
default:
settings.dateFormat = "yyyy-mm-dd"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only sensible date format :)

@senorprogrammer
Copy link
Collaborator

senorprogrammer commented Sep 1, 2021

@tadeaspaule Some linting issues to resolve and there are a few commented-out debugging lines to remove. Once those are resolved, I'll merge this in.

This is a great addition - thanks for improving this!

@tadeaspaule
Copy link
Contributor Author

tadeaspaule commented Sep 1, 2021

OK, everything should be in order now hopefully :) ran gofmt so lints should pass, noticed & fixed some minor issues, namely:

  1. now resorts whole list at startup based on dates (only if dates.enabled). This takes care of dates.undatedAsDays situation changing (either config, or todo that was previously after undated todos should now be before it). @senorprogrammer Curious to hear your opinion on whether the whole list resort should happen more frequently? at the moment only the edited/new item is resorted, and it is assumed that the rest of the list is sorted (again, only if dates.enabled). This way there's less operations

  2. move to first/last now synergises with dates (if dates.enabled): i.e. only moves to first/last of the same date (so if you have 10 todos for tomorrow / 10 todos that are undated, it moves to first/last of those 10). If dates.enabled == false, this happens as expected and moves to the very front/back of list

@senorprogrammer senorprogrammer merged commit b28a620 into wtfutil:master Sep 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants