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

support for deleting completed tasks #7

Open
imeed166 opened this issue Oct 10, 2021 · 15 comments
Open

support for deleting completed tasks #7

imeed166 opened this issue Oct 10, 2021 · 15 comments

Comments

@imeed166
Copy link

@imeed166 imeed166 commented Oct 10, 2021

It would be nice if we could set a maximum number of completed tasks, and if the number of completed tasks exceeds it, the other tasks would automatically be deleted. And of course, if the number is set to "0", then all the tasks completed are deleted automatically.

@ebullient
Copy link
Owner

@ebullient ebullient commented Oct 10, 2021

This plugin never deletes tasks, and, TBH, that's a level of potential information loss I don't want to get near.
Do you mean complete/cancel the rest?

Can you be a little more specific about the workflow you would like, given it has to work well with other kinds of docs that don't support this workflow?

@imeed166
Copy link
Author

@imeed166 imeed166 commented Oct 10, 2021

I'm using obsidian-tasks, and I have many recurrent tasks and I don't care about the completed tasks because the plugin automatically creates a new task with the new date. Unfortunately, the plugin doesn't provide a way to deal with these completed tasks, so I thought maybe I could use your plugin to delete them.

If I could have only one file where the completed tasks automatically delete, my problem would be solved.
Edit: or you could just make an option for only recurring tasks created by obsidian-tasks to be deleted, given that they have specific emojis.

example.mov

@ebullient
Copy link
Owner

@ebullient ebullient commented Oct 11, 2021

@imeed166
Copy link
Author

@imeed166 imeed166 commented Oct 11, 2021

Thank you for the suggestion, but I have too many completed tasks, so selecting each line manually like that would be too time-consuming.

@ebullient
Copy link
Owner

@ebullient ebullient commented Oct 11, 2021

I think it works for a selection.. (select many lines.. )
which.. you should only have to do once?
It might be that a combination of both works... my plugin would move them all to the bottom, which would make them easier to bulk select?

@ebullient
Copy link
Owner

@ebullient ebullient commented Oct 11, 2021

https://github.com/No3371/obsidian-regex-pipeline -- that might work as well (bulk replacement of all matching strings), but I would test in a separate repo first (or use a regular expression tester) to make sure you select only completed tasks matching what the tasks plugins creates.

@imeed166
Copy link
Author

@imeed166 imeed166 commented Oct 11, 2021

I think it works for a selection.. (select many lines.. )

Yes but completed tasks are mixed with ongoing tasks so I can't select them all at once

It might be that a combination of both works... my plugin would move them all to the bottom, which would make them easier to bulk select?

As you said, I have to use your plugin to move them to the bottom, but then how do I bulk select and delete them automatically ?
Edit: I can make a macro with quickadd with these commands :

  • move completed tasks to the bottom of the file
  • select completed tasks ??
  • delete paragraph

The problem is that I can't find a command to select the completed tasks, otherwise this would work.

@imeed166
Copy link
Author

@imeed166 imeed166 commented Oct 11, 2021

https://github.com/No3371/obsidian-regex-pipeline -- that might work as well (bulk replacement of all matching strings), but I would test in a separate repo first (or use a regular expression tester) to make sure you select only completed tasks matching what the tasks plugins creates.

I'll try this method, thank you for proposing.

@imeed166
Copy link
Author

@imeed166 imeed166 commented Oct 11, 2021

I still have to manually apply ruleset with regex pipeline. I was thinking something similar to the setting found in kanban plugin :

image

@ebullient
Copy link
Owner

@ebullient ebullient commented Oct 11, 2021

The more I'm thinking about this... the more it feels like something the tasks plugin itself should be doing.. as it is creating the list that continually grows and knows / has settings for what those look like. Seems like having a limit for how many of those exist is within its mandate, you might say.

@imeed166
Copy link
Author

@imeed166 imeed166 commented Oct 11, 2021

Yeah, you're right. The problem is that the maintainer doesn't have the time to make something like this, as mentioned here.

@ebullient
Copy link
Owner

@ebullient ebullient commented Oct 11, 2021

yea.. I think that person distributes tasks through their repo in a way where the pile up doesn't bother them. Let me think on it. I understand what you're saying, and I'm sympathetic.

Thinking about it... The manual application of the ruleset (that you mentioned above) could be applied to a macro... and macros can be invoked as commands.. and I think you can invoke commands using the advanced URI plugin.. which means.. you could script it (outside of obsidian) ..

though.. if I were scripting it outside of obsidian.. I would probably opt to transform the file directly.

@kmaustral
Copy link

@kmaustral kmaustral commented Jan 6, 2022

Has there been any progress on this? I'd like to reset checklist tasks, but I would need to delete older completed tasks beforehand.

@ebullient
Copy link
Owner

@ebullient ebullient commented Jan 6, 2022

I prefer my plugin to remain non-destructive to avoid data loss. Deleting lines is not something I want to do accidentally. This flow (for me) is about archival within a document where completed tasks have context that I still want to refer to later.

What I would suggest (if you're game) is to try the https://github.com/No3371/obsidian-regex-pipeline plugin. I suggested this earlier, but here is a more detailed explanation:

The regex pipeline plugin uses an index.txt file to list "pipelines" (sequences of regex that should be applied to a document). Have that file list another file called "removeCompletedTasks" (or whatever you like).

removeCompletedTasks should then contain something like:

"^- \[x\] .*\n"->"Replace completed task (including newline)"x

If you want to add other conditions (to only remove tasks that follow a certain pattern), that would be doable. You could also add the follow-on bulk reset here, if they should go together.

Of course, this approach won't work if you only want to reset tasks in a specific section, in which case, I guess I should be more accommodating.

@kmaustral
Copy link

@kmaustral kmaustral commented Jan 7, 2022

A way of limiting task reset to a specific section would be even better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants