Skip to content

Instantly share code, notes, and snippets.

@apainintheneck
Last active November 2, 2024 20:19
Show Gist options
  • Save apainintheneck/8dc5929355328f2d4fbde2397e5a5b0e to your computer and use it in GitHub Desktop.
Save apainintheneck/8dc5929355328f2d4fbde2397e5a5b0e to your computer and use it in GitHub Desktop.
A simple cli wrapper around the `cronex` gem.
#!/usr/bin/env ruby
if ARGV.size != 1
puts "usage: cronex [cron line]"
exit 1
end
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "cronex"
end
begin
puts Cronex::ExpressionDescriptor.new(ARGV.first).description
rescue => e
puts "error: invalid cron line syntax"
puts "message: #{e.message}"
exit 2
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment