bnosac / cronR

A simple R package for managing your cron jobs.
Other
288 stars 38 forks source link

Avoid error if users forgets to provide an answer #62

Closed llrs closed 10 months ago

llrs commented 10 months ago

Thanks for making it easier to write cron jobs from R. I found this little problem after running cron_rm():

Are you sure you want to remove the specified cron job with id 'x'? [y/n]: 1: <intro>
Error in if (!input %in% "y") { : argument is of length zero

Maybe it would be helpful to protect against the user just clicking intro as a default for Yes. This seems like a good opportunity for a little help function as this is also present in cron_add and in other functions. I can send a PR for this.

llrs commented 10 months ago

Related to this, now I realize that the order of the message is not correct:

cron_rm("testing")
Removed 1 cron job.
Are you sure you want to remove the specified cron job with id 'testing'? [y/n]: 1: y
jwijffels commented 10 months ago

Indeed the message on the removed 1 cron job should be after the question :) Feel free to provide a pull request