summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2013-10-29 15:53:04 +0100
committerFlorian Bruhin <git@the-compiler.org>2013-10-29 15:53:04 +0100
commitdff075a095a48ee20a9672847b723554ad8e1160 (patch)
tree77bd1fbab30972b24bee95b7b95a48bde82a68a7
parent6b2ea3ec40d32fddedb133336387e4ed97607c0b (diff)
downloadnewrepo-dff075a095a48ee20a9672847b723554ad8e1160.tar.gz
newrepo-dff075a095a48ee20a9672847b723554ad8e1160.zip
Make more things configurable
-rwxr-xr-xnewrepo.sh33
1 files changed, 28 insertions, 5 deletions
diff --git a/newrepo.sh b/newrepo.sh
index 22e3dc3..cbcd8aa 100755
--- a/newrepo.sh
+++ b/newrepo.sh
@@ -7,23 +7,46 @@ die() {
exit 1
}
-server=git@the-compiler.org
trap '[[ -d "$tmp" ]] && rm -rf "$tmp"' EXIT
+while :; do
+ case $1 in
+ --server)
+ opt_server="$2"
+ shift 2
+ ;;
+ --private)
+ opt_private=yes
+ shift
+ ;;
+ --name)
+ opt_name="$2"
+ shift 2
+ *)
+ break
+ ;;
+ esac
+done
+
top=$(git rev-parse --show-toplevel)
-name=${top##*/}
-if [[ "$1" == --private ]]; then
+server=${opt_server:-git@the-compiler.org}
+if [[ "$opt_name" ]]; then
+ name="$opt_name"
+else
+ name=${top##*/}
+fi
+
+if [[ "$opt_private" ]]; then
user="@private"
- shift
else
user="@public"
fi
desc="$1"
-[[ -z "$desc" ]] && die "Usage: $0 [--private] <description>"
+[[ -z "$desc" ]] && die "Usage: $0 [--private] [--server <server>] [--name <name>] <description>"
tmp=$(mktemp -d)
cd "$tmp"