Skip to content
This repository has been archived by the owner on Feb 14, 2020. It is now read-only.

Commit

Permalink
adding a -o flag to disable ip check as suggested in #17
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Hann committed Oct 30, 2015
1 parent 70ae201 commit 4d6eb8c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ brew install archey
* -b, --nocolor : Use black & white logo
* -c, --color : Force using a color Logo
* -m, --macports : Use MacPorts instead of Homebrew to display package count
* -o --offline Disable the IP address check
* -h, --help : Show help


Expand Down
21 changes: 16 additions & 5 deletions bin/archey
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fi
# Get the command line options
opt_nocolor=f
opt_force_color=f
opt_offline=f
for arg in "$@"
do
case "${arg}" in
Expand All @@ -25,12 +26,16 @@ do
opt_nocolor=f
opt_force_color=t
;;
-o|--offline)
opt_offline=t
;;
-h|--help)
echo "Usage: $0 [options]"
echo
echo " -m --macports Use MacPorts as package system (default packager: ${packager})."
echo " -b --nocolor Turn color off."
echo " -c --color Force the color on (overrides --nocolor)."
echo " -m --macports Use MacPorts as package system (default packager: ${packager})."
echo " -b --nocolor Turn color off."
echo " -c --color Force the color on (overrides --nocolor)."
echo " -o --offline Disable the IP address check."
exit 0
;;
*)
Expand All @@ -44,7 +49,11 @@ done
# System Variables
user=$(whoami)
hostname=$(hostname | sed 's/.local//g')
ip=$(dig +short myip.opendns.com @resolver1.opendns.com)

if [[ "${opt_offline}" = f ]]; then
ip=$(dig +short myip.opendns.com @resolver1.opendns.com)
fi

distro="OS X $(sw_vers -productVersion)"
kernel=$(uname)
uptime=$(uptime | sed 's/.*up \([^,]*\), .*/\1/')
Expand Down Expand Up @@ -92,7 +101,9 @@ hostnameText="${textColor}Hostname:${normal} ${hostname}${normal}"
distroText="${textColor}Distro:${normal} ${distro}${normal}"
kernelText="${textColor}Kernel:${normal} ${kernel}${normal}"
uptimeText="${textColor}Uptime:${normal} ${uptime}${normal}"
ipText="${textColor}IP Address:${normal} ${ip}${normal}"
if [ "${opt_offline}" = f ]; then
ipText="${textColor}IP Address:${normal} ${ip}${normal}"
fi
shellText="${textColor}Shell:${normal} ${shell}${normal}"
terminalText="${textColor}Terminal:${normal} ${terminal}${normal}"
packagehandlerText="${textColor}Packages:${normal} ${packagehandler}${normal}"
Expand Down

0 comments on commit 4d6eb8c

Please sign in to comment.