changeset 497:f19b23b11328 default tip

Added hgc and hgd aliases
author unexist
date Wed, 01 Jul 2020 14:13:07 +0200
parents 3954af64d52c
children
files .zshalias
diffstat 1 files changed, 27 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/.zshalias	Wed Jul 01 14:12:47 2020 +0200
+++ b/.zshalias	Wed Jul 01 14:13:07 2020 +0200
@@ -66,7 +66,32 @@
 command -v hg &>/dev/null
 
 if [ $? -eq 0 ]; then
-    alias hgs="hg status|grep -v '^?'"
+    alias hgs="hg status | grep -v '^?'"
+
+    local function find_file_by_idx() {
+        local IDX=${1}
+        local STATUS=`hg status | grep -v '^?'`
+
+        echo ${STATUS}
+
+        if [ -z "${IDX}" ] ; then
+            vared -p "Idx? " -c IDX
+        fi
+
+        FILE=`echo ${STATUS} | sed -n "${IDX}p" | cut -d ' ' -f2`
+    }
+
+    function hgd() {
+        find_file_by_idx
+
+        hg diff ${FILE}
+    }
+
+    function hgc() {
+        find_file_by_idx
+
+        hg ci ${FILE}
+    }
 fi
 
 # Git
@@ -147,7 +172,7 @@
 command -v rsync &>/dev/null
 
 if [ $? -eq 0 ]; then
-  alias rsync="rsync -trvh"
+  alias rsync="rsync -trvh --progress"
 fi
 
 # Java