mirror of https://github.com/bjeanes/dotfiles.git
Make Zsh and Bash have some level of method_missing support
parent
13d272f97d
commit
d2bcb3a57b
1
README
1
README
|
@ -4,6 +4,7 @@
|
|||
* Make `rake install` install a .git pre-commit hook to remind about or automatically remove all API keys from dot files (gitconfig, etc)
|
||||
* Make `rake install` set up a loop that will always try to `git pull` the dot-files (if working directory is clean) so they are always up to date
|
||||
* Remove 'export' from variables that don't need them
|
||||
* Make current directory red in prompt if non-writeable (ala fish)
|
||||
|
||||
Copyright (c) 2008-2010 Bodaniel Jeanes
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ command = ARGV.shift
|
|||
|
||||
def run(cmd)
|
||||
puts "Running #{cmd.inspect} instead"
|
||||
system(cmd)
|
||||
exec(cmd)
|
||||
end
|
||||
|
||||
case command
|
||||
|
@ -14,7 +14,9 @@ when /^(?:ftp|https?):\/\/.+\.t(?:ar\.)?gz$/
|
|||
run("curl #{command.inspect} | tar xzv")
|
||||
when /^[a-z0-9_\-\/]+\.feature$/
|
||||
run("cucumber #{command}")
|
||||
when /(.+)\.gem$/
|
||||
run("gem install #{$1}")
|
||||
else
|
||||
$stderr.puts "No default action defined in #{__FILE__.inspect}"
|
||||
$stderr.puts "No default action defined in #{__FILE__}"
|
||||
abort
|
||||
end
|
|
@ -31,3 +31,16 @@ function extract() {
|
|||
echo "'$1' is not a valid file"
|
||||
fi
|
||||
}
|
||||
|
||||
# Custom "command not found" handling (ala method_missing):
|
||||
|
||||
# Zsh
|
||||
function command_not_found_handler() {
|
||||
/usr/bin/env ruby $DOT_FILES/misc/method_missing.rb $*
|
||||
}
|
||||
|
||||
# Bash (call Zsh version)
|
||||
function command_not_found_handle() {
|
||||
command_not_found_handler $*
|
||||
return $?
|
||||
}
|
Loading…
Reference in New Issue