commit
fcefefee8b
|
@ -239,6 +239,7 @@ alias fetch2="fetch \
|
|||
--shell_version on/off Enable/Disable showing \$SHELL version
|
||||
--battery_num num Which battery to display, default value is 'all'
|
||||
--battery_shorthand on/off Whether or not each battery gets its own line/title
|
||||
--ip_host url Url to ping for public IP
|
||||
--birthday_shorthand on/off Shorten the output of birthday
|
||||
--birthday_time on/off Enable/Disable showing the time in birthday output
|
||||
|
||||
|
@ -273,8 +274,6 @@ alias fetch2="fetch \
|
|||
--shuffle_dir path/to/dir Which directory to shuffle for an image.
|
||||
--font_width px Used to automatically size the image
|
||||
--image_position left/right Where to display the image: (Left/Right)
|
||||
--split_size num Width of img/text splits, A value of 2 makes each
|
||||
split half the terminal width and etc.
|
||||
--crop_mode mode Which crop mode to use
|
||||
Takes the values: normal, fit, fill
|
||||
--crop_offset value Change the crop offset for normal mode.
|
||||
|
|
|
@ -130,6 +130,13 @@ battery_num="all"
|
|||
battery_shorthand="off"
|
||||
|
||||
|
||||
# IP Address
|
||||
|
||||
# Website to ping for the public IP
|
||||
# --ip_host url
|
||||
public_ip_host="http://ident.me"
|
||||
|
||||
|
||||
# Birthday
|
||||
|
||||
# Whether to show a long pretty output
|
||||
|
|
50
fetch
50
fetch
|
@ -150,6 +150,13 @@ battery_num="all"
|
|||
battery_shorthand="off"
|
||||
|
||||
|
||||
# IP Address
|
||||
|
||||
# Website to ping for the public IP
|
||||
# --ip_host url
|
||||
public_ip_host="http://ident.me"
|
||||
|
||||
|
||||
# Birthday
|
||||
|
||||
# Whether to show a long pretty output
|
||||
|
@ -1335,6 +1342,47 @@ getbattery () {
|
|||
|
||||
# }}}
|
||||
|
||||
# IP Address {{{
|
||||
|
||||
getlocalip () {
|
||||
case "$os" in
|
||||
"Linux")
|
||||
localip="$(ip route get 1 | awk '{print $NF;exit}')"
|
||||
;;
|
||||
|
||||
"Mac OS X")
|
||||
localip="$(ipconfig getifaddr en0)"
|
||||
[ -z "$localip" ] && localip="$(ipconfig getifaddr en1)"
|
||||
;;
|
||||
|
||||
*"BSD")
|
||||
localip="$(ifconfig | awk '/broadcast/ {print $2}')"
|
||||
;;
|
||||
|
||||
"Windows")
|
||||
localip="$(ipconfig | awk -F ': ' '/IPv4 Address/ {printf $2}')"
|
||||
;;
|
||||
|
||||
*)
|
||||
localip="Unknown"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
getpublicip () {
|
||||
if type -p curl >/dev/null 2>&1; then
|
||||
publicip="$(curl -w '\n' "$public_ip_host")"
|
||||
|
||||
elif type -p wget >/dev/null 2>&1; then
|
||||
publicip="$(wget -qO- "$public_ip_host"; printf "%s")"
|
||||
|
||||
else
|
||||
publicip="Unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
# }}}
|
||||
|
||||
# Birthday {{{
|
||||
|
||||
getbirthday () {
|
||||
|
@ -2122,6 +2170,7 @@ usage () { cat << EOF
|
|||
--shell_version on/off Enable/Disable showing \$SHELL version
|
||||
--battery_num num Which battery to display, default value is 'all'
|
||||
--battery_shorthand on/off Whether or not each battery gets its own line/title
|
||||
--ip_host url Url to ping for public IP
|
||||
--birthday_shorthand on/off Shorten the output of birthday
|
||||
--birthday_time on/off Enable/Disable showing the time in birthday output
|
||||
|
||||
|
@ -2226,6 +2275,7 @@ while [ "$1" ]; do
|
|||
--shell_version) shell_version="$2" ;;
|
||||
--battery_num) battery_num="$2" ;;
|
||||
--battery_shorthand) battery_shorthand="$2" ;;
|
||||
--ip_host) public_ip_host="$2" ;;
|
||||
--birthday_shorthand) birthday_shorthand="$2" ;;
|
||||
--birthday_time) birthday_time="$2" ;;
|
||||
--disable)
|
||||
|
|
Reference in New Issue