#!/bin/bash set -e # stg-show - unlike "stg show", just "git show" with knowledge of stg refs # Ex: # stg-show --color-words -- files # Copyright (c) 2007 Yann Dirson # Subject to the GNU GPL, version 2. command=(git show) # substitute git id's for stg ones until -- while [ "$#" -gt 0 ]; do case "$1" in --) break ;; -*) command+=("$1"); shift ;; *) command+=( $(stg id "$1" 2>/dev/null || echo "$1") ); shift ;; esac done # append remaining args command+=("$@") eval "${command[@]}"