<commit_before>#!/usr/bin/env bash

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

source "$CURRENT_DIR/helpers.sh"

online_wan_option_string="@online_wan_icon"
offline_wan_option_string="@offline_wan_icon"
route_to_ping_string="@route_to_ping"

online_wan_icon_osx="ⓦ "
online_wan_icon="WAN IP "
offline_wan_icon_osx="⨂ "
offline_wan_icon="NO INERNET ACCESS "
route_to_ping_default="www.google.com"
route_to_ip_default="http://whatismyip.akamai.com/"

online_wan_icon_default() {
	if is_osx; then
		echo "$online_wan_icon_osx"
	else
		echo "$online_wan_icon"
	fi
}
offline_wan_icon_default() {
	if is_osx; then
		echo "$offline_wan_icon_osx"
	else
		echo "$offline_wan_icon"
	fi
}

online_wan_status() {
	ping -c 1 $(get_tmux_option "$route_to_ping_string" "$route_to_ping_default") >/dev/null 2>&1
}

ip_wan_status() {
  curl --max-time 2 -s http://whatismyip.akamai.com/
}

print_wan_status() {
	# spacer fixes weird emoji spacing
	local spacer=" "
	if $(online_wan_status); then
    printf "$(get_tmux_option "$online_wan_option_string" "$(online_wan_icon_default)")$spacer$(ip_wan_status)"
	else
		printf "$(get_tmux_option "$offline_wan_option_string" "$(offline_wan_icon_default)")$spacer"
	fi
}

main() {
  print_wan_status
}
main
<commit_msg>Make icon for linux shorten<commit_after>#!/usr/bin/env bash

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

source "$CURRENT_DIR/helpers.sh"

online_wan_option_string="@online_wan_icon"
offline_wan_option_string="@offline_wan_icon"
route_to_ping_string="@route_to_ping"

online_wan_icon_osx="ⓦ "
online_wan_icon="WAN: "
offline_wan_icon_osx="⨂ "
offline_wan_icon="NO INERNET ACCESS "
route_to_ping_default="www.google.com"
route_to_ip_default="http://whatismyip.akamai.com/"

online_wan_icon_default() {
	if is_osx; then
		echo "$online_wan_icon_osx"
	else
		echo "$online_wan_icon"
	fi
}
offline_wan_icon_default() {
	if is_osx; then
		echo "$offline_wan_icon_osx"
	else
		echo "$offline_wan_icon"
	fi
}

online_wan_status() {
	ping -c 1 $(get_tmux_option "$route_to_ping_string" "$route_to_ping_default") >/dev/null 2>&1
}

ip_wan_status() {
  curl --max-time 2 -s http://whatismyip.akamai.com/
}

print_wan_status() {
	# spacer fixes weird emoji spacing
	local spacer=" "
	if $(online_wan_status); then
    printf "$(get_tmux_option "$online_wan_option_string" "$(online_wan_icon_default)")$spacer$(ip_wan_status)"
	else
		printf "$(get_tmux_option "$offline_wan_option_string" "$(offline_wan_icon_default)")$spacer"
	fi
}

main() {
  print_wan_status
}
main

{'fraction_non_alphanumeric': 0.1376470588235294, 'fraction_numerical': 0.00392156862745098, 'mean_word_length': 6.637724550898204, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3910283', 'n_tokens_mistral': 1087, 'n_tokens_neox': 1034, 'n_words': 163}