jeff-hughes / shellcaster

Terminal-based podcast manager built in Rust
GNU General Public License v3.0
199 stars 14 forks source link

ask for confirmation before removing podcasts or episodes #24

Closed dougli1sqrd closed 4 years ago

dougli1sqrd commented 4 years ago

Hello, I love the terminal podcast app! About a week ago I just googled "terminal podcast app rust" and here it is! I'm relatively new to rust, and to contributing to other people's projects.

I accidentally deleted a podcast by hitting r and had to re-add the feed. I was already building the 1.0.1 release locally and running that, so I thought I would poke around.

What this does is add a ask_for_confirmation method on the UI struct that prompts the user like the "delete local files" prompt. Then this is used first thing in the remove_podcast and remove_all_episodes methods to confirm the remove action. This prevents accidentally removing podcasts or episodes.

If the user types 'n' or cancels then it's not confirmed and the remove is not done.

Please feel free to change anything, or I can fix anything you dislike! Also no worries if this is not even something you want to do!

jeff-hughes commented 4 years ago

Awesome, this looks great! I think it's completely reasonable to add an extra little check in there so people don't accidentally hit the wrong button and delete something unexpectedly.

Testing this did also reveal a bug (in my code, not yours) where the line wasn't getting properly cleared -- so the next message prompt would end up where the previous one left off, rather than back at the beginning of the line. But I figured out a fix for that, so I'll add that in as well. Thanks for your contribution, and glad you're finding shellcaster useful!