From 5f57468d14f78f1dc4f524eaf5868da93dafafe1 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 12 Mar 2012 16:05:35 -0400 Subject: [PATCH] allow running in other repo dirs --- .bin/cros-repo | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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 -- 2.39.5