From 1206026bd0f41cd4550a379f2ea83bc7fe4efb25 Mon Sep 17 00:00:00 2001 From: Ville Rantanen Date: Thu, 23 Jul 2015 11:50:00 +0300 Subject: [PATCH] hgmenu interactive mercurial --- bin/hgmenu | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100755 bin/hgmenu diff --git a/bin/hgmenu b/bin/hgmenu new file mode 100755 index 0000000..5cd9d29 --- /dev/null +++ b/bin/hgmenu @@ -0,0 +1,95 @@ +#!/bin/bash + +function usage { +echo -e ' Mercurial menu + +Usage: hgmenu [args] + hgmenu will interactively query for a command to use. + [args] will be passed on to that command + +' +} + +function argsreq { + echo Arguments required + exit +} + +while getopts h opt +do case "$opt" in + h) + usage + exit + ;; + esac +done + +echo 'Mercurial: +a: Add files* +c: Commit +d: Diff +l: Log +m: merge +p: Pull +P: Push +r: Remove files* +u: Update +s: Status +t: Start thg +v: View + +q: Quit + +* Requires arguments +' + +echo Current arguments: "$@" +read -p "Command: " -s -N 1 CMD +echo "" +LESS="less -R -S" +case "$CMD" in + a) + [[ -z "$@" ]] && argsreq + hg add "$@" + ;; + c) + read -p "Commit message: " MSG + hg commit -m "$MSG" "$@" + ;; + d) + hg diff --color always "$@"| $LESS + ;; + l) + hg log -G --color always "$@"| $LESS + ;; + m) + hg merge "$@" + ;; + p) + hg pull "$@" + ;; + P) + hg push "$@" + ;; + r) + [[ -z "$@" ]] && argsreq + hg remove "$@" + ;; + u) + hg update "$@" + ;; + s) + hg status --color always "$@" | $LESS + ;; + t) + thg "$@"& + ;; + v) + hg view "$@"& + ;; + q) + exit + ;; +esac + +