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

Adding offline mode #25

Merged
merged 2 commits into from
Oct 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ An archey script for OS X.
* [License](#license)

##Download
The latest stable release is [1.4](https://github.com/obihann/archey-osx/archive/1.4.tar.gz).
The latest stable release is [1.5](https://github.com/obihann/archey-osx/archive/1.5.tar.gz).

##Installation
To get started you will need [homebrew](http://brew.sh/) to manage packages such as Python, figlet, and cowsay. To install please run the following command:
Expand All @@ -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