mirror of
https://github.com/basecamp/omarchy.git
synced 2026-02-17 15:25:37 +00:00
Add port forwarding functions for web dev
So we can forward a port on localhost to an Omaterm
This commit is contained in:
@@ -87,3 +87,18 @@ img2png() {
|
||||
-define png:exclude-chunk=all \
|
||||
"${img%.*}-optimized.png"
|
||||
}
|
||||
|
||||
# SSH Port Forwarding Functions
|
||||
fip() {
|
||||
[[ -z "$1" || -z "$2" ]] && echo "Usage: fip <port> <host>" && return 1
|
||||
ssh -f -N -L "$1:localhost:$1" "$2" && echo "Forwarding localhost:$1 -> $2:$1"
|
||||
}
|
||||
|
||||
dip() {
|
||||
[[ -z "$1" ]] && echo "Usage: dip <port>" && return 1
|
||||
pkill -f "ssh.*-L $1:localhost:$1" && echo "Stopped forwarding port $1" || echo "No forwarding on port $1"
|
||||
}
|
||||
|
||||
lip() {
|
||||
pgrep -af "ssh.*-L [0-9]+:localhost:[0-9]+" || echo "No active forwards"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user