wayneashleyberry / wunderline

✅️ Command-line client for Wunderlist, the easiest way to get stuff done.
https://git.io/vM45l
MIT License
309 stars 29 forks source link

Add cli flag to only export completed tasks #104

Closed adius closed 7 years ago

Thor77 commented 7 years ago

I don't really see the usecase for that in the export-subcommand, can you elaborate why you think this feature is useful?

adius commented 7 years ago

I don't really see the usecase for that in the export-subcommand

😳 I was really surprised that it only exported the open tasks. If I export data from a program I expect it to export all data it has. So I actually I would per default export the open and the completed tasks and add --open and --completed flags if one wants to only export a subset.

adius commented 7 years ago

If you export your emails from your email app you don't expect it to only export your unread emails either, would you? ^^

Thor77 commented 7 years ago

So I actually I would per default export the open and the completed tasks and add --open and --completed flags if one wants to only export a subset.

Yeah, that sounds like the right way to do it, feel free to open another PR for the additional flag and changing the default output (or include it into this one). Therefore I will merge your PR once you fix the two things mentioned in my review.

Thor77 commented 7 years ago

Is there anything I can help you with to get this PR ready for merge @adius ?

adius commented 7 years ago

Not sure if this is the most beautiful solution, but the limited Wunderlist API doesn't make things easy…

Thor77 commented 7 years ago

Thanks for taking a look again and implementing the additional flag right away. I'm not sure about changing the default, though. What do you think, @wayneashleyberry ?

wayneashleyberry commented 7 years ago

From my side I'd leave these filters out of the export command. Export was only ever intended to give you all of your data, what you then choose to do with it is up to you.

There are many tools available such as jid and jq which provide excellent filtering for json.

Here is an example of filtering only your starred tasks from a full export using jq.

wunderline export | jq '.data.lists[].tasks[] | select(.starred == true)'

Theoretically a similar filter could be applied to get completed or uncompleted tasks, but I deleted all of my completed tasks haha

wunderline export | jq '.data.lists[].tasks[] | select(.completed == true)'
wayneashleyberry commented 7 years ago

Hey @adius, I'm going to close this pull request. I appreciate you pointing out that completed tasks weren't being exported, but I've opted for a simpler implementation.

wayneashleyberry commented 7 years ago

Merged in https://github.com/wayneashleyberry/wunderline/pull/105 and published as v4.4.4.

Please let me know if you're happy @adius. I've also updated the readme with examples for filtering out the exported data.

adius commented 7 years ago

Looks good, Thanks!