alpinweis / cronex

Ruby library that converts cron expressions into human readable strings
Other
78 stars 29 forks source link

Add executable command #31

Closed apainintheneck closed 1 week ago

apainintheneck commented 10 months ago

I'd like to be able to use cronex as a quick command line utility. Would it be possible to add an executable command that takes cron lines and turns them into a more human readable format?

$ cronex '*/5 15 * * 1-5'
Every 5 minutes, at 3:00 PM, Monday through Friday

I'd be happy to work on this if it sounds like an interesting feature.

rickychilcott commented 1 week ago

Make a PR!

alpinweis commented 1 week ago

I had the cli in the original implementation but decided to leave it out back then because people seem to have different preferences around the cli and how they use it.

apainintheneck commented 1 week ago

I had the cli in the original implementation but decided to leave it out back then because people seem to have different preferences around the cli and how they use it.

Yeah, I can see how it might be a bit more complex than my example if it supports all of the options for Cronex::ExpressionDescriptor but I'm not sure that's necessary for me personally. Here's a simple script that achieves what I want with bundler/inline so it's probably not necessary to add this to the gem.

Closing as my script does what I want and bundler/inline makes it portable (I wasn't really aware of that when I first opened this issue).