Skip to content

Instantly share code, notes, and snippets.

@DannyBen
Last active January 2, 2020 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DannyBen/a4adefbcfbcd93cde7d941684bc947ac to your computer and use it in GitHub Desktop.
Save DannyBen/a4adefbcfbcd93cde7d941684bc947ac to your computer and use it in GitHub Desktop.
cron-explain - CLI for showing cron expression in plain English
#!/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