Skip to content

Instantly share code, notes, and snippets.

@paulosuzart
Created May 20, 2013 18:47
Show Gist options
  • Save paulosuzart/5614350 to your computer and use it in GitHub Desktop.
Save paulosuzart/5614350 to your computer and use it in GitHub Desktop.
Firs fish functions to help daily.
function -d "Adds a function with the machine name, so you can connect to it" addMachine
test -r $HOME/.config/fish/functions/$argv.fish; and rm $HOME/.config/fish/functions/$argv.fish; and echo "Replacing existing machine: $argv"; or echo "Seting up $argv"
echo "#Function added by addMachine" >> "$HOME/.config/fish/functions/$argv.fish"
echo "function -d \"connects to $argv machine.\" $argv" >> "$HOME/.config/fish/functions/$argv.fish"
echo " connect $argv" '$argv' >> "$HOME/.config/fish/functions/$argv.fish"
echo "end" >> "$HOME/.config/fish/functions/$argv.fish"
end
function -d "Connects to a given machine. dc and local domains are allowed" connect
echo $argv
set machine $argv[1]
set machineNumber $argv[2]
set domain $argv[3]
switch $domain
case prd
set domain your.prd.domain
case dev
set domain your.dev.domain
case '*'
echo Please inform the domain to connect to
end
echo "Connecting to $machine$machineNumber.$domain......."
ssh "$machine$machineNumber.$domain" -lroot -A
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment