my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
437 B

3 years ago
  1. function knife_ssh() {
  2. grep -q $1 ~/.knife_comp~ 2> /dev/null || rm -f ~/.knife_comp~
  3. ssh $(knife node show $1 | awk '/IP:/{print $2}')
  4. }
  5. _knife_ssh() {
  6. if hash knife 2>/dev/null; then
  7. if [[ ! -f ~/.knife_comp~ ]]; then
  8. echo "\nGenerating ~/.knife_comp~..." >&2
  9. knife node list > ~/.knife_comp~
  10. fi
  11. compadd $(< ~/.knife_comp~)
  12. else
  13. echo "Could not find knife" >&2
  14. fi
  15. }
  16. compdef _knife_ssh knife_ssh