From 6c1e2ec9f4a4728dd6338b2e4ea648f6b5cd59ae Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 26 Jun 2008 19:31:30 +0200 Subject: etc/functions: Splitup into seperate files per function --- etc/functions | 63 -------------------------------------------- etc/functions/cdl | 4 +++ etc/functions/chpwd | 10 +++++++ etc/functions/extr | 24 +++++++++++++++++ etc/functions/l | 12 +++++++++ etc/functions/plonkhost | 3 +++ etc/functions/world-readable | 3 +++ etc/rc | 2 +- 8 files changed, 57 insertions(+), 64 deletions(-) delete mode 100644 etc/functions create mode 100644 etc/functions/cdl create mode 100644 etc/functions/chpwd create mode 100644 etc/functions/extr create mode 100644 etc/functions/l create mode 100644 etc/functions/plonkhost create mode 100644 etc/functions/world-readable (limited to 'etc') diff --git a/etc/functions b/etc/functions deleted file mode 100644 index 113560f..0000000 --- a/etc/functions +++ /dev/null @@ -1,63 +0,0 @@ -## Functions -## vim:ft=zsh -# builtin function for archives, see $ZDIR/alias_suffix -extr () { - if [[ -f "$1" ]]; then - case "$1" in - *.tar.bz2) tar xjvf "$1" ;; - *.tar.gz) tar xvzf "$1" ;; - *.ace) unace e "$1" ;; - *.rar) unrar x "$1" ;; - *.deb) ar -x "$1" ;; - *.bz2) bzip2 -d "$1" ;; - *.lzh) lha x "$1" ;; - *.gz) gunzip -d "$1" ;; - *.tar) tar xvf "$1" ;; - *.tgz) gunzip -d "$1" ;; - *.tbz2) tar jxvf "$1" ;; - *.zip) unzip "$1" ;; - *.Z) uncompress "$1" ;; - *.shar) sh "$1" ;; - *) echo "I don't know the archive type of '"$1"' :(" ;; - esac - else - echo "Hm. Seems '"$1"' is not a valid file." - fi -} - -# self-explaining, I think -l () { - if [[ -f "$1" ]]; then - case "$1" in - *.bz2) bzless "$1" ;; - *.gz) zless "$1" ;; - *) less "$1" ;; - esac - else - echo "No such file, dude." - fi -} - -cdl () { - cd "$1"; - ls; -} - -world-readable () { - chmod -R a+rX . -} - -chpwd () { - pstags='' - [ -f .todo ] && pstags+='todo ' - [ -f .fehindex.jpg ] && pstags+='feh ' - [ -d .hg ] && pstags+='hg ' - [ -d .git ] && pstags+='git ' - [ -d .svn ] && pstags+='svn ' - [ -f Makefile -o -f makefile ] && pstags+='make ' - source $ZDIR/prompt -} - -plonkhost () { - sudo iptables -I INPUT -s "$1" -j DROP -} diff --git a/etc/functions/cdl b/etc/functions/cdl new file mode 100644 index 0000000..49b4d7f --- /dev/null +++ b/etc/functions/cdl @@ -0,0 +1,4 @@ +cdl () { + cd "$1"; + ls; +} diff --git a/etc/functions/chpwd b/etc/functions/chpwd new file mode 100644 index 0000000..8cfd926 --- /dev/null +++ b/etc/functions/chpwd @@ -0,0 +1,10 @@ +chpwd () { + pstags='' + [ -f .todo ] && pstags+='todo ' + [ -f .fehindex.jpg ] && pstags+='feh ' + [ -d .hg ] && pstags+='hg ' + [ -d .git ] && pstags+='git ' + [ -d .svn ] && pstags+='svn ' + [ -f Makefile -o -f makefile ] && pstags+='make ' + source $ZDIR/prompt +} diff --git a/etc/functions/extr b/etc/functions/extr new file mode 100644 index 0000000..784671b --- /dev/null +++ b/etc/functions/extr @@ -0,0 +1,24 @@ +# builtin function for archives, see $ZDIR/alias_suffix +extr () { + if [[ -f "$1" ]]; then + case "$1" in + *.tar.bz2) tar xjvf "$1" ;; + *.tar.gz) tar xvzf "$1" ;; + *.ace) unace e "$1" ;; + *.rar) unrar x "$1" ;; + *.deb) ar -x "$1" ;; + *.bz2) bzip2 -d "$1" ;; + *.lzh) lha x "$1" ;; + *.gz) gunzip -d "$1" ;; + *.tar) tar xvf "$1" ;; + *.tgz) gunzip -d "$1" ;; + *.tbz2) tar jxvf "$1" ;; + *.zip) unzip "$1" ;; + *.Z) uncompress "$1" ;; + *.shar) sh "$1" ;; + *) echo "I don't know the archive type of '"$1"' :(" ;; + esac + else + echo "Hm. Seems '"$1"' is not a valid file." + fi +} diff --git a/etc/functions/l b/etc/functions/l new file mode 100644 index 0000000..d461998 --- /dev/null +++ b/etc/functions/l @@ -0,0 +1,12 @@ +# self-explaining, I think +l () { + if [[ -f "$1" ]]; then + case "$1" in + *.bz2) bzless "$1" ;; + *.gz) zless "$1" ;; + *) less "$1" ;; + esac + else + echo "No such file, dude." + fi +} diff --git a/etc/functions/plonkhost b/etc/functions/plonkhost new file mode 100644 index 0000000..3b6cc95 --- /dev/null +++ b/etc/functions/plonkhost @@ -0,0 +1,3 @@ +plonkhost () { + sudo iptables -I INPUT -s "$1" -j DROP +} diff --git a/etc/functions/world-readable b/etc/functions/world-readable new file mode 100644 index 0000000..c66a479 --- /dev/null +++ b/etc/functions/world-readable @@ -0,0 +1,3 @@ +world-readable () { + chmod -R a+rX . +} diff --git a/etc/rc b/etc/rc index 420d240..52546a8 100644 --- a/etc/rc +++ b/etc/rc @@ -14,7 +14,7 @@ alias 'debian:'='[ -n "$debian" ] &&' source $ZDIR/modules source $ZDIR/variables source $ZDIR/colors -source $ZDIR/functions +source $ZDIR/functions/* source $ZDIR/options source $ZDIR/prompt source $ZDIR/directories -- cgit v1.2.3