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.
 
 

32 lines
729 B

#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/helpers.sh"
ip_address="$($CURRENT_DIR/ip_address.sh)"
do_interpolation() {
local string="$1"
local ip_addr=$ip_address
if [ -z "$ip_address" ]
then
ip_addr="Offline"
fi
local interpolated="$(echo $1 | sed "s/\(Offline\|[[:digit:]]\{1,3\}\.[[:digit:]]\{1,3\}\.[[:digit:]]\{1,3\}\.[[:digit:]]\{1,3\}\)/$ip_addr/g")"
echo "$interpolated"
}
update_tmux_option() {
local option="$1"
local option_value="$(get_tmux_option "$option")"
local new_option_value="$(do_interpolation "$option_value")"
set_tmux_option "$option" "$new_option_value"
}
main() {
update_tmux_option "status-right"
}
main