Sha256: 250e593986e068e7df3618ddf87696637204d42fe2bbd6dcbfc78f175c7465be
Contents?: true
Size: 648 Bytes
Versions: 11
Compression:
Stored size: 648 Bytes
Contents
#!/usr/bin/env ruby require "rubygems" require "shorturl" def usage puts "Usage: #$0 <url> [<service>]" puts "Available services:" ShortURL.valid_services.each { |s| puts "\t#{s}" } exit(-1) end def main if ARGV.size < 1 usage end url = ARGV[0] service = ARGV[1] shorturl = if service.nil? ShortURL.shorten(url) else if ShortURL.valid_services.include?(service.to_sym) ShortURL.shorten(url, service.to_sym) else puts "Invalid service" exit(-1) end end puts shorturl end main
Version data entries
11 entries across 11 versions & 2 rubygems