Last active
January 2, 2020 14:56
-
-
Save DannyBen/a4adefbcfbcd93cde7d941684bc947ac to your computer and use it in GitHub Desktop.
cron-explain - CLI for showing cron expression in plain English
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Show cron expression in plain english | |
# Place in /usr/local/bin and chmod +x | |
require 'bundler/inline' | |
gemfile do | |
source "https://rubygems.org" | |
gem 'cron2english' | |
end | |
cronspec = ARGV[0] | |
abort "Usage: cron-explain CRON_EXPRESSION" unless cronspec | |
begin | |
puts Cron2English.parse(cronspec).join "\n" | |
rescue Cron2English::ParseException => e | |
puts e.message | |
exit 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment