hgmenu installs its requirements

This commit is contained in:
Ville Rantanen
2015-07-24 10:29:46 +03:00
parent 1206026bd0
commit 1b37ff416a

View File

@@ -25,34 +25,43 @@ do case "$opt" in
done done
echo 'Mercurial: 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
a: Add files to track*
c: Commit changes to local repository
d: Difference of current and previous versions
l: Log
m: Merge conflicting change sets
p: Pull changes from remote repository
P: Push changes to remote repository
r: Remove files*
u: Update from local repository
s: Status
t: Start thg, graphical repository viewer
v: View, internal graphical viewer
X: Add the required extensions to your ~/.hgrc
q: Quit q: Quit
* Requires arguments * Requires arguments
' '
echo Current arguments: "$@" echo Current arguments: "$@"
read -p "Command: " -s -N 1 CMD read -p "Command: " -N 1 CMD
echo "" echo ""
LESS="less -R -S" LESS="less -R -S"
case "$CMD" in case "$CMD" in
a) a)
[[ -z "$@" ]] && argsreq [[ -z "$@" ]] && argsreq
find "$@" \( -type d -name .hg -prune \) -o -type f -print
read -p "Add all these files? y/n" foo
[[ $foo = "n" ]] && exit
hg add "$@" hg add "$@"
;; ;;
c) c)
[[ -z "$@" ]] || {
echo Commiting files:
find "$@" \( -type d -name .hg -prune \) -o -type f -print
}
read -p "Commit message: " MSG read -p "Commit message: " MSG
hg commit -m "$MSG" "$@" hg commit -m "$MSG" "$@"
;; ;;
@@ -73,6 +82,9 @@ case "$CMD" in
;; ;;
r) r)
[[ -z "$@" ]] && argsreq [[ -z "$@" ]] && argsreq
find "$@" \( -type d -name .hg -prune \) -o -type f -print
read -p "Remove all these files? y/n" foo
[[ $foo = "n" ]] && exit
hg remove "$@" hg remove "$@"
;; ;;
u) u)
@@ -90,6 +102,25 @@ case "$CMD" in
q) q)
exit exit
;; ;;
X)
grep -q "color\s*=" ~/.hgrc || {
grep -q "^[extensions]" ~/.hgrc && {
sed '0,/^\[extensions\]/s//[extensions]\ncolor=/' ~/.hgrc
} || {
echo -e "[extensions]\ncolor="
}
}
grep -q "hgk\s*=" ~/.hgrc || {
grep -q "^[extensions]" ~/.hgrc && {
sed '0,/^\[extensions\]/s//[extensions]\nhgk=/' ~/.hgrc
} || {
echo -e "[extensions]\nhgk="
}
}
;;
*)
echo Command $CMD not recognized
;;
esac esac