chezmoi init
This commit is contained in:
commit
530d6d7195
1176 changed files with 111325 additions and 0 deletions
14
dot_oh-my-zsh/plugins/knife_ssh/README.md
Normal file
14
dot_oh-my-zsh/plugins/knife_ssh/README.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
# knife_ssh plugin
|
||||
|
||||
This plugin adds a `knife_ssh` function as well as completion for it, to allow
|
||||
connecting via ssh to servers managed with [Chef](https://www.chef.io/).
|
||||
|
||||
To use it, add `knife_ssh` to the plugins array in your zshrc file:
|
||||
```zsh
|
||||
plugins=(... knife_ssh)
|
||||
```
|
||||
|
||||
The plugin creates a cache of the Chef node list via `knife`, and stores it
|
||||
in `$HOME/.knife_comp~`, when first triggering knife_ssh completion.
|
||||
|
||||
**Requirements:** `knife` has to be installed.
|
18
dot_oh-my-zsh/plugins/knife_ssh/knife_ssh.plugin.zsh
Normal file
18
dot_oh-my-zsh/plugins/knife_ssh/knife_ssh.plugin.zsh
Normal file
|
@ -0,0 +1,18 @@
|
|||
function knife_ssh() {
|
||||
grep -q $1 ~/.knife_comp~ 2> /dev/null || rm -f ~/.knife_comp~
|
||||
ssh $(knife node show $1 | awk '/IP:/{print $2}')
|
||||
}
|
||||
|
||||
_knife_ssh() {
|
||||
if hash knife 2>/dev/null; then
|
||||
if [[ ! -f ~/.knife_comp~ ]]; then
|
||||
echo "\nGenerating ~/.knife_comp~..." >&2
|
||||
knife node list > ~/.knife_comp~
|
||||
fi
|
||||
compadd $(< ~/.knife_comp~)
|
||||
else
|
||||
echo "Could not find knife" >&2
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _knife_ssh knife_ssh
|
Loading…
Add table
Add a link
Reference in a new issue