Add prefix option for branch creation

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2022-09-28 12:27:15 +02:00
parent befb138a8e
commit 3e907e91f3
Signed by: luzifer
GPG Key ID: 0066F03ED215AD7D

View File

@ -2,4 +2,20 @@
set -euo pipefail
git checkout -b $(slugify "$@" | cut -c 1-72)
prefix=""
while getopts ":p:" o; do
case "${o}" in
p)
prefix="${OPTARG}"
;;
*)
usage
fatal "Invalid option -- ${OPTARG}"
;;
esac
done
shift $((OPTIND - 1))
branchname="${prefix}/$(slugify "$@" | cut -c 1-72)"
git checkout -b "${branchname##/}"