Created
May 13, 2019 14:04
-
-
Save neptaco/580e212d0c508a440a77f175990ff55f to your computer and use it in GitHub Desktop.
fast vagrant ssh
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
function vagrant | |
set config ".vagrant/ssh_config" | |
set cmd (which vagrant) | |
if [ $argv[1] = 'ssh' ] | |
pushd . > /dev/null | |
while not test -e Vagrantfile; and [ $PWD != '/' ] | |
cd .. | |
end | |
if [ $PWD = '/' ] | |
echo 'Not found Vagrantfile' | |
else | |
# make ssh_config | |
if not test -e $config | |
$cmd ssh-config > $config | |
end | |
# ssh vagrant | |
if test (count $argv) -gt 1 | |
/usr/bin/ssh -F $config $argv[2..-1] | |
else | |
/usr/bin/ssh -F $config default | |
end | |
end | |
popd > /dev/null | |
else | |
$cmd $argv[1..-1] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment