jarun / buku

:bookmark: Personal mini-web in text
GNU General Public License v3.0
6.5k stars 294 forks source link

Feature request: batch delete #41

Closed ghost closed 8 years ago

ghost commented 8 years ago

It would be useful to delete multiple records at once:

jarun commented 8 years ago

Added to TODO list at #39.

Please discuss new features in the rolling TODO list thread. That way a consistent record of new features is maintained.

ghost commented 8 years ago

Ok. I will do it like that in the future. Sorry

jarun commented 8 years ago

Hey, no problem at all! Keeping an organized journal makes it easier to track the discussions.

jarun commented 8 years ago

Deletion of range OR list of indices implemented at https://github.com/jarun/Buku/commit/2abeffe4c56715b51eb359b645e08e79166e326c.

Note that both don't work together... the major reasons being indexes may fall within a range and auto-compaction may delete non-intended indices.

It would be great if you can test the feature and provide feedback.

NOTE: I may not implement delete all records based on a search result, seems to unconventional and probably a overkill with the different delete options provided now.

ghost commented 8 years ago

I confirm that deleting a range or a list of records works now. However deleting multipole ranges doesn't. I assume this is not implemented.

About deleting based on a search result, for me this would be very useful. It will allow to cleanup the bookmarks database easily. For example: delete all records matching a tag, outdated subject.. etc It is not straightforward to do this by searching and then delete specific records (by providing the indexes, or ranges).

I would create a combined function (search & delete). Eg. $ buku -s "subject" -d

By the way, currently, if you execute the above command, first it will want to delete the entire database, then to perform the search. ;) I would keep the operations separated.. while the combined function is not available.

jarun commented 8 years ago

Got it! Would it be possible for you to contribute this feature?

By the way, currently, if you execute the above command, first it will want to delete the entire database, then to perform the search.

True. -s and -d are treated separately and -d has higher priority. BTW, it does confirm before deleting everything now... thanks to your other issue.

jarun commented 8 years ago

However deleting multipole ranges doesn't

Intentional. buku -d 5-12 6-11 11-14 would be a lot of unnecessary pain. If you check man or help I did mention single range.

ghost commented 8 years ago

Got it! Would it be possible for you to contribute this feature?

Not too much spare time, but I'll look at it in the following days.

True. -s and -d are treated separately and -d has higher priority.

Yes, but I don't quite see the logic behind using both at the same time if the combined function is not available (yet). And in this particular case, when no argument is provided to "-d", they're mutually exclusive. I mean you delete the database (records), then search for something ?

jarun commented 8 years ago

Not too much spare time, but I'll look at it in the following days.

Thanks! It would be great if you can manage some time.

I mean you delete the database (records), then search for something ?

I see your point. Won't be much of a bother changing the order but just thinking if there's a better way to handle stuff. We can make stuff mutually exclusive (but how many?). I think, rather, if you get some time, define an order for the operations. We can discuss and finalize it.

I can do the last one, but I won't see it from your perspective which is why I'm looking for a primary check from you first. The operations are all commented in main so you don't need to look at the code for this.

ghost commented 8 years ago

Created pull request https://github.com/jarun/Buku/pull/49 Please review Thanks