Skip to content

Instantly share code, notes, and snippets.

@jamie jamie/.zshrc
Created Oct 17, 2013

Embed
What would you like to do?
function command_not_found_handler() {
~/bin/command-not-found $*
}
#!/usr/bin/env ruby
command = ARGV.first
def run(cmd)
$stderr.puts "Running #{cmd.inspect} instead"
system(cmd)
end
case
# Paste git repo url to clone it
when command =~ /^git(@|:\/\/).*\.git$/
run("git clone #{command.inspect}")
# paste compressed url to download+extract it
when command =~ /^(?:ftp|https?):\/\/.+\.t(?:ar\.)?gz$/
run("curl #{command.inspect} | tar xzv")
when File.exist?("./tmp/isolate/ruby-1.8/bin/#{command}")
run("rake isolate:sh['#{ARGV.join(' ')}']")
when File.exist?("./.bundle/config") && (File.exist?("./bin/#{command}") || File.exist?("./bins/#{command}"))
run("bundle exec #{ARGV.join(' ')}")
else
exit 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.