Permalink
Browse files

Update ,i ,s and ,ls for Mac/Homebrew

  • Loading branch information...
1 parent cda7b69 commit 4fbbf872984f758c199c9da6e65282a60e5ca9e6 @rking rking committed with rkingpa@sharpsaw.org Jan 24, 2013
Showing with 22 additions and 10 deletions.
  1. +10 −5 bin/,i
  2. +2 −0 bin/,ls
  3. +10 −5 bin/,s
View
@@ -1,12 +1,17 @@
#!/bin/bash -e
## Package install using emerge or aptitude, whichever's available.
-if type emerge &>/dev/null; then
+has() { type $1 &>/dev/null; }
+if has emerge; then
sudo emerge -atv "$@"
-elif type aptitude &>/dev/null || type apt-get &>/dev/null; then
- apti "$@"
-elif type zypper &>/dev/null; then
+elif has aptitude; then
+ sudo aptitude install "$@"
+elif has apt-get; then
+ sudo apt-get install "$@"
+elif has zypper; then
sudo zypper -n install "$@"
+elif has brew; then
+ brew install "$@"
else
- echo "Found neither \`emerge\`, \`aptitude\` nor \`apt-get\` in $PATH"
+ echo "Found none of emerge, aptitude, apt-get, zypper, brew in $PATH"
echo "Perhaps you can teach \`,i\` how to work for your system?"
fi
View
@@ -10,6 +10,8 @@ elif type dpkg &>/dev/null; then
dpkg -L "$@"
elif type rpm &>/dev/null; then
rpm -ql "$@"
+elif type brew &>/dev/null; then
+ brew list "$@"
else
echo ",ls needs to be updated for this distro."
fi
View
@@ -1,12 +1,17 @@
#!/bin/bash -e
+has() { type $1 &>/dev/null; }
## Package search using eix or aptitude, whichever's present.
-if type eix &>/dev/null; then
+if has eix; then
eix "$@"
-elif type aptitude &>/dev/null || type apt-cache &>/dev/null; then
- apts "$@"
-elif type zypper &>/dev/null; then
+elif has aptitude; then
+ aptitude search "$@"
+elif has apt-cache; then
+ apt-cache search "$@"
+elif has zypper; then
zypper search "$@"
+elif has brew; then
+ brew search "$@"
else
- echo "Found neither \`eix\`, \`aptitude\` nor \`apt-cache\` in $PATH"
+ echo "Found none of exi, aptitude, apt-cache, zypper, brew in $PATH"
echo "Perhaps you can teach \`,s\` how to work for your system?"
fi

0 comments on commit 4fbbf87

Please sign in to comment.