Added cdg function
This commit is contained in:
parent
b244c70ab2
commit
f5f62c6ba0
|
@ -83,6 +83,34 @@ makelatex() {
|
|||
cp /home/thomas/.script/classgen/Makefile.latex ./Makefile
|
||||
}
|
||||
|
||||
# cdg : cd to a git repo
|
||||
if [ -d "$GCLONE_PATH" ]; then
|
||||
cdg() {
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "This function expects a single parameter"
|
||||
return 1
|
||||
else
|
||||
dir=`find $GCLONE_PATH -maxdepth 3 -name $1`
|
||||
|
||||
if [[ "" == "$dir" ]]; then
|
||||
echo "$1 not found"
|
||||
return 2
|
||||
elif [ `echo $dir | wc -l` -gt 2 ]; then
|
||||
echo "Multiple entries for $1 found"
|
||||
return 3
|
||||
else
|
||||
cd $dir
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
_cdg() {
|
||||
_arguments "1: :($(find $GCLONE_PATH -maxdepth 3 -exec basename {} \;))"
|
||||
}
|
||||
|
||||
compdef _cdg cdg
|
||||
fi
|
||||
|
||||
# Music things
|
||||
# command -v music-server > /dev/null 2>&1
|
||||
# if [ $? -eq 0 ]; then
|
||||
|
|
Loading…
Reference in New Issue