Created
January 7, 2013 18:43
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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