Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

add --update and --version #7

Merged
merged 2 commits into from

2 participants

@tj
tj commented

BALLER

@rauchg
Owner

BALLER

@rauchg rauchg merged commit d7bcb44 into rauchg:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 5, 2012
  1. @tj

    add --update and --version

    tj authored
  2. @tj

    fix whitespace

    tj authored
This page is out of date. Refresh to see the latest.
Showing with 42 additions and 20 deletions.
  1. +42 −20 spot.sh
View
62 spot.sh
@@ -1,5 +1,7 @@
#!/usr/bin/env bash
+version="0.0.1"
+
# search directory defaults to current
dir=.
@@ -21,7 +23,7 @@ cyan=`echo -e '\033[96m'`
reset=`echo -e '\033[39m'`
# usage info
-function usage {
+usage() {
cat <<EOF
Usage: spot [options] [directory] [term ...]
@@ -32,32 +34,52 @@ function usage {
-i, --insensitive Force case insensitive search.
-C, --no-colors Force avoid colors.
-L, --no-linenums Hide line numbers.
+ -U, --update Update spot(1)
+ -V, --version Output version
-h, --help This message.
EOF
}
+# update spot(1) via git clone
+update() {
+ cd /tmp \
+ && echo "... updating" \
+ && git clone --depth 1 git://github.com/guille/spot.git \
+ && cd spot \
+ && make install \
+ && echo "... updated to $(spot --version)"
+ exit
+}
+
# parse options
while [[ "$1" =~ ^- ]]; do
- case $1 in
- -s | --sensitive )
- sensitive=1
- ;;
- -i | --insensitive )
- sensitive=
- ;;
- -C | --no-colors )
- colors=
- ;;
- -L | --no-linenums )
- linenums=
- ;;
- -h | --help )
- usage
- exit
- ;;
- esac
- shift
+ case $1 in
+ -V | --version )
+ echo $version
+ exit
+ ;;
+ -s | --sensitive )
+ sensitive=1
+ ;;
+ -i | --insensitive )
+ sensitive=
+ ;;
+ -C | --no-colors )
+ colors=
+ ;;
+ -L | --no-linenums )
+ linenums=
+ ;;
+ -U | --update )
+ update
+ ;;
+ -h | --help )
+ usage
+ exit
+ ;;
+ esac
+ shift
done
# check for directory as first parameter
Something went wrong with that request. Please try again.