From: Mike Frysinger Date: Mon, 12 Mar 2012 20:05:35 +0000 (-0400) Subject: allow running in other repo dirs X-Git-Url: https://git.wh0rd.org/?p=home.git;a=commitdiff_plain;h=5f57468d14f78f1dc4f524eaf5868da93dafafe1 allow running in other repo dirs --- diff --git a/.bin/cros-repo b/.bin/cros-repo index d6c6de1..6f51357 100755 --- a/.bin/cros-repo +++ b/.bin/cros-repo @@ -1,9 +1,8 @@ #!/bin/sh -cd ~/chromiumos usage() { cat <<-EOF - Usage: repo-cros [command opts] + Usage: repo-cros [dir] [command opts] Commands: int switch to internal tree @@ -14,14 +13,26 @@ usage() { } [[ $# -eq 0 ]] && usage -vexec() { echo "$@"; exec "$@"; } +vexec() { + cd ${DIR:-~/chromiumos} + printf '%s\n%s\n' "${PWD}" "$*" + exec "$@" +} +DIR= while [[ $# -gt 0 ]] ; do case $1 in int) vexec repo init -u ssh://gerrit-int.chromium.org:29419/chromeos/manifest-internal.git --repo-url='http://git.chromium.org/external/repo.git' ;; ext) vexec repo init -u http://git.chromium.org/chromiumos/manifest.git --repo-url http://git.chromium.org/external/repo.git ;; -b) vexec repo init -b $2 ;; - *) usage ;; + *) + if [[ -z ${DIR} ]] ; then + DIR=$1 + else + usage + fi + ;; esac + shift done exit 0