Compare commits

..

2 Commits

2 changed files with 9 additions and 5 deletions

View File

@@ -20,6 +20,12 @@ It peeks into that file and offers auto-completion based on saved sessions. It c
sudo ln -s <repo>/hs.sh /usr/local/bin/hs sudo ln -s <repo>/hs.sh /usr/local/bin/hs
chmod +x <repo>/hs.sh chmod +x <repo>/hs.sh
``` ```
1. Run:
```
hs <TAB>
```
This will list all HeidiSQL sessions that have `NetType` set to `2` aka `MariaDB or MySQL (SSH tunnel)`. Select one and `hs` creates the necessary tunnel.
# What it looks like # What it looks like
@@ -27,8 +33,6 @@ Here with `fzf` as auto-completion helper (optional, is a personal preference):
![Screencast showing hs in action](https://i.imgur.com/FhVFtaR.gif) ![Screencast showing hs in action](https://i.imgur.com/FhVFtaR.gif)
> Here `hs` first attempts to set up an SSH tunnel for a HeidiSQL saved session and fails because something's already listening on the local port. > Here `hs` first attempts to set up an SSH tunnel for a HeidiSQL saved session and fails because something's already listening on the local port. We `kill` the connection in question - an SSH tunnel from a prior test - and try again. This time `hs` correctly creates our tunnel. With `set -xv` we see the actual command that gets executed.
>
> We `kill` the connection in question - an SSH tunnel from a prior test - and try again. This time `hs` correctly creates our tunnel. With `set -xv` we see the actual command that gets executed.
> >
> Once done we clean up after ourselves and kill SSH tunnels we no longer need. > Once done we clean up after ourselves and kill SSH tunnels we no longer need.

4
hs
View File

@@ -1,5 +1,4 @@
_hs() function _hs () {
{
local cur prev local cur prev
COMPREPLY=() COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[COMP_CWORD]}"
@@ -37,4 +36,5 @@ _hs()
return 0 return 0
fi fi
} }
complete -F _hs hs complete -F _hs hs