Skip to content

Instantly share code, notes, and snippets.

@kristjan
Created January 7, 2013 18:43
Show Gist options
  • Save kristjan/4477370 to your computer and use it in GitHub Desktop.
Save kristjan/4477370 to your computer and use it in GitHub Desktop.
Simple wrapper to use HTTPS more natively with https://github.com/jkbr/httpie
#!/usr/bin/env ruby
PROTOCOL = %r{[\w-]+://?}
URL = %r{^((#{PROTOCOL}|\w+[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))$}
args = ARGV.to_a
args.each_with_index do |arg, i|
args[i] = "https://#{arg}" if arg =~ URL && arg !~ PROTOCOL
end
system("http #{args.join(' ')}")
exit $?.exitstatus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment