Use $OSTYPE instead of uname to speed things up

The $OSTYPE variable is set at ZSH compile time and can be safely used
to determine the OS of the system. e.g. darwin (os x)
master
Christian Höltje 12 years ago committed by Christian Höltje
parent 207b6a1e33
commit 63bae2aba9
  1. 2
      plugins/battery/battery.plugin.zsh
  2. 2
      plugins/bundler/bundler.plugin.zsh
  3. 2
      plugins/jira/jira.plugin.zsh
  4. 2
      plugins/node/node.plugin.zsh
  5. 2
      plugins/rake-fast/rake-fast.plugin.zsh
  6. 2
      plugins/sublime/sublime.plugin.zsh
  7. 2
      plugins/web-search/web-search.plugin.zsh

@ -8,7 +8,7 @@
# Modified to add support for Apple Mac # # Modified to add support for Apple Mac #
########################################### ###########################################
if [[ $(uname) == "Darwin" ]] ; then if [[ "$OSTYPE" = darwin* ]] ; then
function battery_pct() { function battery_pct() {
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")" local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"

@ -54,7 +54,7 @@ bundle_install() {
if _bundler-installed && _within-bundled-project; then if _bundler-installed && _within-bundled-project; then
local bundler_version=`bundle version | cut -d' ' -f3` local bundler_version=`bundle version | cut -d' ' -f3`
if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
if [[ "$(uname)" == 'Darwin' ]] if [[ "$OSTYPE" = darwin* ]]
then then
local cores_num="$(sysctl hw.ncpu | awk '{print $2}')" local cores_num="$(sysctl hw.ncpu | awk '{print $2}')"
else else

@ -12,7 +12,7 @@
# jira ABC-123 # Opens an existing issue # jira ABC-123 # Opens an existing issue
open_jira_issue () { open_jira_issue () {
local open_cmd local open_cmd
if [[ $(uname -s) == 'Darwin' ]]; then if [[ "$OSTYPE" = darwin* ]]; then
open_cmd='open' open_cmd='open'
else else
open_cmd='xdg-open' open_cmd='xdg-open'

@ -3,7 +3,7 @@
function node-docs { function node-docs {
# get the open command # get the open command
local open_cmd local open_cmd
if [[ $(uname -s) == 'Darwin' ]]; then if [[ "$OSTYPE" = darwin* ]]; then
open_cmd='open' open_cmd='open'
else else
open_cmd='xdg-open' open_cmd='xdg-open'

@ -10,7 +10,7 @@ _rake_refresh () {
_rake_does_task_list_need_generating () { _rake_does_task_list_need_generating () {
if [ ! -f .rake_tasks ]; then return 0; if [ ! -f .rake_tasks ]; then return 0;
else else
if [[ $(uname -s) == 'Darwin' ]]; then if [[ "$OSTYPE" = darwin* ]]; then
accurate=$(stat -f%m .rake_tasks) accurate=$(stat -f%m .rake_tasks)
changed=$(stat -f%m Rakefile) changed=$(stat -f%m Rakefile)
else else

@ -17,7 +17,7 @@ if [[ $('uname') == 'Linux' ]]; then
fi fi
done done
elif [[ $('uname') == 'Darwin' ]]; then elif [[ "$OSTYPE" = darwin* ]]; then
local _sublime_darwin_paths > /dev/null 2>&1 local _sublime_darwin_paths > /dev/null 2>&1
_sublime_darwin_paths=( _sublime_darwin_paths=(
"/usr/local/bin/subl" "/usr/local/bin/subl"

@ -4,7 +4,7 @@ function web_search() {
# get the open command # get the open command
local open_cmd local open_cmd
if [[ $(uname -s) == 'Darwin' ]]; then if [[ "$OSTYPE" = darwin* ]]; then
open_cmd='open' open_cmd='open'
else else
open_cmd='xdg-open' open_cmd='xdg-open'

Loading…
Cancel
Save