hgmenu interactive mercurial
This commit is contained in:
95
bin/hgmenu
Executable file
95
bin/hgmenu
Executable file
@@ -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
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user