Sha256: 2f61b52035d8fea1dd08b7dd2da6e3a554143a5b8b772218b72e00e3f01f448a

Contents?: true

Size: 734 Bytes

Versions: 1

Compression:

Stored size: 734 Bytes

Contents

#!/usr/bin/env ruby

require 'lib/corto'
require 'getoptlong'

opts = GetoptLong.new(
  [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
  [ '--version', '-v', GetoptLong::NO_ARGUMENT ]
)

begin 
opts.each do |opt, arg|
  case opt
    when '--help'
      puts 'usage: corto [-h|-v] url_to_shrink'
      exit 0
    when '--version'
      @version = File.exist?('VERSION') ? File.read('VERSION') : ""
      puts @version
      exit 0
  end
end
rescue 
  exit 0
end
if ARGV.length != 1
  raise 'usage: corto [-h|-v] url_to_shrink'
  exit 0
end

corto = Corto.new 
s = corto.shrink(ARGV[0])
if (!s.nil?) 
  puts 'corto: ' + ARGV[0] + ' shrinked as ' + s
else
  puts 'corto: it seems ' + ARGV[0] + ' is not a valid url to shrink'
end
exit 0  

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
corto-0.60.0 bin/corto