]> Untitled Git - hvutilities.git/commitdiff
hvk-rebase: add debug option
authorHugo Villeneuve <hugo@hugovil.com>
Wed, 25 Mar 2026 13:54:24 +0000 (09:54 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Wed, 25 Mar 2026 13:57:44 +0000 (09:57 -0400)
Signed-off-by: Hugo Villeneuve <hugo@hugovil.com>
scripts/hvk-rebase.sh

index 2c9b14f303bc009ee837ed64c3c0cca1edd3e2ee..b56ef042fda5e28995fa0a0153d43b22396706df 100755 (executable)
@@ -5,6 +5,42 @@ set -e
 SCRIPT="`readlink -e $0`"
 SCRIPTPATH=$(dirname ${SCRIPT})
 
+print_usage()
+{
+    echo "${PROG_NAME} -- Rebase git branches"
+    echo "Usage: ${PROG_NAME} [OPTIONS...]"
+    echo
+    echo "Options:"
+    echo "  -d   debug mode"
+    echo
+}
+
+while getopts "dh" flag ;do
+    case ${flag} in
+        d)
+            debug="1"
+            ;;
+       h)
+           print_usage
+            exit 0
+            ;;
+        ?)
+            echo "${PROG_NAME}: Option invalide: ${OPTARG}."
+            echo "Essayez \`${PROG_NAME} -h' pour plus d'informations."
+            exit 1
+            ;;
+    esac
+done
+shift `expr "${OPTIND}" - 1`
+
+export debug
+
+if [ "${debug}" = "1" ]; then
+    Q=""
+else
+    Q="-q"
+fi
+
 hvk_src=.hvk-rebase
 
 if [ ! -f ${hvk_src} ]; then
@@ -22,4 +58,4 @@ current_branch=$(git branch --show-current)
 source ${hvk_src}
 
 # Return to original branch:
-git checkout ${current_branch}
+git checkout ${Q} ${current_branch}