]> git.madduck.net Git - code/vcsh.git/blobdiff - vcsh

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Release v1.20131229
[code/vcsh.git] / vcsh
diff --git a/vcsh b/vcsh
index 0c43fd35591aee02e66e60d262ece85ff32c77e3..9f413f6c67fa1c468c07259ed29e768c0f2c298b 100755 (executable)
--- a/vcsh
+++ b/vcsh
@@ -16,7 +16,7 @@
 [ -n "$VCSH_DEBUG" ] && set -vx
 
 SELF=$(basename $0)
-VERSION='1.20131214.git-HEAD'
+VERSION='1.20131229'
 
 fatal() {
        echo "$SELF: fatal: $1" >&2
@@ -359,8 +359,8 @@ write_gitignore() {
        done | sort -u)
 
        # Contrary to GNU mktemp, mktemp on BSD/OSX requires a template for temp files
-       # Use the template GNU mktemo defaults to
-       # The downside to this is that we need to account for unset TMPDIR
+       # Using a template makes GNU mktemp default to $PWD and not #TMPDIR for tempfile location
+       # To make every OS happy, set full path explicitly
        tempfile=$(mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX") || fatal "could not create tempfile: '${tempfile}'" 51
 
        echo '*' > "$tempfile" || fatal "could not write to '$tempfile'" 57
@@ -391,22 +391,23 @@ fi
 
 export VCSH_COMMAND="$1"
 
-[ "$VCSH_COMMAND" = 'clon' ]   || [ "$VCSH_COMMAND" = 'clo' ]   || [ "$VCSH_COMMAND" = 'cl' ]                                                                && VCSH_COMMAND='clone'
-[ "$VCSH_COMMAND" = 'commi' ]  || [ "$VCSH_COMMAND" = 'comm' ]  || [ "$VCSH_COMMAND" = 'com' ]  || [ "$VCSH_COMMAND" = 'co' ]                                && VCSH_COMMAND='commit'
-[ "$VCSH_COMMAND" = 'delet' ]  || [ "$VCSH_COMMAND" = 'dele' ]  || [ "$VCSH_COMMAND" = 'del' ]  || [ "$VCSH_COMMAND" = 'de' ]                                && VCSH_COMMAND='delete'
-[ "$VCSH_COMMAND" = 'ente' ]   || [ "$VCSH_COMMAND" = 'ent' ]   || [ "$VCSH_COMMAND" = 'en' ]                                                                && VCSH_COMMAND='enter'
-[ "$VCSH_COMMAND" = 'hel' ]    || [ "$VCSH_COMMAND" = 'he' ]                                                                                                 && VCSH_COMMAND='help'
-[ "$VCSH_COMMAND" = 'ini' ]    || [ "$VCSH_COMMAND" = 'in' ]                                                                                                 && VCSH_COMMAND='init'
-[ "$VCSH_COMMAND" = 'pul' ]                                                                                                                                  && VCSH_COMMAND='pull'
-[ "$VCSH_COMMAND" = 'pus' ]                                                                                                                                  && VCSH_COMMAND='push'
-[ "$VCSH_COMMAND" = 'renam' ]  || [ "$VCSH_COMMAND" = 'rena' ]  || [ "$VCSH_COMMAND" = 'ren' ]  || [ "$VCSH_COMMAND" = 're' ]                                && VCSH_COMMAND='rename'
-[ "$VCSH_COMMAND" = 'ru' ]                                                                                                                                   && VCSH_COMMAND='run'
-[ "$VCSH_COMMAND" = 'statu' ]  || [ "$VCSH_COMMAND" = 'stat' ]  || [ "$VCSH_COMMAND" = 'sta' ]  || [ "$VCSH_COMMAND" = 'st' ]                                && VCSH_COMMAND='status'
-[ "$VCSH_COMMAND" = 'upgrad' ] || [ "$VCSH_COMMAND" = 'upgra' ] || [ "$VCSH_COMMAND" = 'upgr' ] || [ "$VCSH_COMMAND" = 'upg' ]                               && VCSH_COMMAND='upgrade'
-[ "$VCSH_COMMAND" = 'versio' ] || [ "$VCSH_COMMAND" = 'versi' ] || [ "$VCSH_COMMAND" = 'vers' ] || [ "$VCSH_COMMAND" = 'ver' ] || [ "$VCSH_COMMAND" = 've' ] && VCSH_COMMAND='version'
-[ "$VCSH_COMMAND" = 'whic' ]   || [ "$VCSH_COMMAND" = 'whi' ]   || [ "$VCSH_COMMAND" = 'wh' ]                                                                && VCSH_COMMAND='which'
-[ "$VCSH_COMMAND" = 'write' ]  || [ "$VCSH_COMMAND" = 'writ' ]  || [ "$VCSH_COMMAND" = 'wri' ]  || [ "$VCSH_COMMAND" = 'wr' ]                                && VCSH_COMMAND='write-gitignore'
-
+case "$VCSH_COMMAND" in
+       clon|clo|cl) VCSH_COMMAND=clone;;
+       commi|comm|com|co) VCSH_COMMAND=commit;;
+       delet|dele|del|de) VCSH_COMMAND=delete;;
+       ente|ent|en) VCSH_COMMAND=enter;;
+       hel|he) VCSH_COMMAND=help;;
+       ini|in) VCSH_COMMAND=init;;
+       pul) VCSH_COMMAND=pull;;
+       pus) VCSH_COMMAND=push;;
+       renam|rena|ren|re) VCSH_COMMAND=rename;;
+       ru) VCSH_COMMAND=run;;
+       statu|stat|sta|st) VCSH_COMMAND=status;;
+       upgrad|upgra|upgr|up) VCSH_COMMAND=upgrade;;
+       versio|versi|vers|ver|ve) VCSH_COMMAND=version;;
+       which|whi|wh) VCSH_COMMAND=which;;
+       write|writ|wri|wr) VCSH_COMMAND=write-gitignore;;
+esac    
 
 if [ "$VCSH_COMMAND" = 'clone' ]; then
        [ -z "$2" ] && fatal "$VCSH_COMMAND: please specify a remote" 1