summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTslil Clingman <hiato1@gmail.com>2013-08-09 14:03:45 +0200
committerTslil Clingman <hiato1@gmail.com>2013-08-09 14:03:45 +0200
commitf2b32d25177be465c7209072eb93ae14fc16dfa3 (patch)
tree52e8d412518d5b3d4c70c068b7ef11dde6cac03d
parent3bd9f307d5cd0128ea4fa37aaecaadac5629521c (diff)
The vcs script I use for my PS1 and some minor changes
-rwxr-xr-xaur6
-rwxr-xr-xce (renamed from d)0
-rwxr-xr-xranpas9
-rwxr-xr-xvcs47
4 files changed, 56 insertions, 6 deletions
diff --git a/aur b/aur
index 8d5b071..dfe68c1 100755
--- a/aur
+++ b/aur
@@ -7,7 +7,7 @@ if [ "$1" = "-s" ]; then
exit
fi;
-cd prog/aur
+cd ~/prog/aur
echo Pulling...
wget "https://aur.archlinux.org/packages/`echo $1|cut -b 1-2`/$1/$1.tar.gz"
@@ -25,5 +25,5 @@ if [ -f "$1.tar.gz" ]; then
name=$1"-`sed -n 's/pkgver=//p' PKGBUILD`-`sed -n 's/pkgrel=//p' PKGBUILD`"
echo Installing...
sudo pacman -U $name*.xz
- fi;
-fi;
+ fi
+fi
diff --git a/d b/ce
index 982e885..982e885 100755
--- a/d
+++ b/ce
diff --git a/ranpas b/ranpas
index 2681bf2..4ee1188 100755
--- a/ranpas
+++ b/ranpas
@@ -2,9 +2,10 @@
#!/bin/bash
echo Fetching paste list ...
-lst="$(wget pastie.org/pastes -q -O - | sed -n "0,/[\ \t]*e=\$('paste_/s///p" | tr -d "');")"
+lst=`wget pastie.org/pastes -q -O - | grep "id='paste" | head -n 1 | sed "s/.*id='paste_\([0-9]*\)'.*/\1/"`
echo Newest paste is $lst.
+r=""
while :; do
rnd="$(ruby -e "$><<1+rand($lst)")"
echo -e "\n"Looking up paste $rnd ...
@@ -16,12 +17,14 @@ while :; do
else
less /tmp/paste-$rnd
echo -n Save?\
- [ "$(line)" = "y" ] && echo Saving as paste $rnd in $HOME && cp /tmp/paste-$rnd $HOME
+ read r
+ [ "$r" = "y" ] && echo Saving as paste $rnd in $HOME && cp /tmp/paste-$rnd $HOME
fi;
else
echo Empty paste.
fi;
rm /tmp/paste-$rnd
echo -n Quit?\
- [ "$(line)" = "y" ] && exit
+ read r
+ [ "$r" = "y" ] && exit
done;
diff --git a/vcs b/vcs
new file mode 100755
index 0000000..aee37cf
--- /dev/null
+++ b/vcs
@@ -0,0 +1,47 @@
+#!/bin/zsh
+
+check() {
+ echo $1 | grep -q $2;
+};
+
+VCS_STR=""
+VCS_INF=""
+VCS_NEW=""
+VCS_MOD=""
+VCS_REC=""
+
+nstr=" %F{red}●%f"
+mstr=" %F{11}●%f"
+rstr=" %F{28}●%f"
+
+if [[ -d ".git" || -d "../.git" || -d "../../.git" ]]; then
+ outp=$(git status)
+ VCS_STR="×"
+ VCS_INF=$(echo $outp | head -n 1 | cut -d' ' -f 4-)
+ check $outp "^# Untracked files:$"
+ [[ $? = 0 ]] && VCS_NEW=$nstr
+ check $outp "^# Changes not staged for commit:$"
+ [[ $? = 0 ]] && VCS_MOD=$mstr
+ check $outp "^# Changes to be committed:$"
+ [[ $? = 0 ]] && VCS_REC=$rstr
+else if [[ -d "_darcs" || -d "../_darcs" || -d "../../_darcs" ]]; then
+ fls=$(darcs show files)
+ VCS_STR="+"
+ VCS_INF=$(darcs show repo | grep Default | cut -d : -f 3-)
+ for f in ./*; do
+ if [[ -f $f ]]; then
+ echo $fls | grep -q $f
+ else
+ true
+ fi;
+ if [[ ! $? = 0 ]]; then
+ VCS_NEW=$nstr;
+ break;
+ fi;
+ done;
+ news=$(darcs what)$
+ check $news "^No changes!$"
+ [[ ! $? = 0 ]] && VCS_REC=$rstr
+fi; fi;
+
+[[ ! "$VCS_STR" = "" ]] && echo "%F{green}$VCS_STR%f{%F{blue}$VCS_INF%f$VCS_REC$VCS_MOD$VCS_NEW}"