953e4d892631f93e31cfdfb72199fb8f413c6b49

Author
Ben Klein <robobenklein@gmail.com>
Committer
Ben Klein <robobenklein@gmail.com>
Date

Message

Make Linux compatible

Just an if/else to determine if we're OSX or Linux and alias `at` appropriately.

Diff

 1diff --git a/plugins/atom/atom.plugin.zsh b/plugins/atom/atom.plugin.zsh
 2index 9adb9031a0e9c61c113a0e210531f5f3fdc5f4e2..ec1a114edeb67221e0f203646fb0daf30fabbe07 100644
 3--- a/plugins/atom/atom.plugin.zsh
 4+++ b/plugins/atom/atom.plugin.zsh
 5@@ -1,14 +1,22 @@
 6-local _atom_paths > /dev/null 2>&1
 7-_atom_paths=(
 8-    "$HOME/Applications/Atom.app"
 9-    "/Applications/Atom.app"
10-)
11+# Gets OS Type
12+unamestr=$(uname -s)
13 
14-for _atom_path in $_atom_paths; do
15-    if [[ -a $_atom_path ]]; then
16-        alias at="open -a '$_atom_path'"
17-        break
18-    fi
19-done
20+# If OSX
21+if [[ "$unamestr" == 'Darwin' ]]; then
22+    local _atom_paths > /dev/null 2>&1
23+    _atom_paths=(
24+        "$HOME/Applications/Atom.app"
25+        "/Applications/Atom.app"
26+    )
27 
28-alias att='at .'
29+    for _atom_path in $_atom_paths; do
30+        if [[ -a $_atom_path ]]; then
31+            alias at="open -a '$_atom_path'"
32+            break
33+        fi
34+    done
35+# If Linux
36+elif [[ "$unamestr" == 'Linux' ]]; then
37+    # Alerts the user if 'atom' is not a found command.
38+    type atom >/dev/null 2>&1 && alias at="atom" || { echo >&2 "You have enabled the atom oh-my-zsh plugin on Linux, but atom is not a recognized command. Please make sure you have it installed before using this plugin."; }
39+fi