From 88ed4809398dce676ba516e2016f8b51d53b4720 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 22 Nov 2017 09:15:07 +0100 Subject: function cleanup --- etc/.zshrc | 32 ++++++++++++++++++++++++++++++++ etc/functions/extract | 24 ------------------------ etc/functions/gtd-all | 10 ---------- etc/functions/gtd-move | 22 ---------------------- etc/functions/hugin | 3 --- etc/functions/mkcd | 13 ------------- etc/functions/world-readable | 1 - 7 files changed, 32 insertions(+), 73 deletions(-) delete mode 100644 etc/functions/extract delete mode 100644 etc/functions/gtd-all delete mode 100644 etc/functions/gtd-move delete mode 100644 etc/functions/hugin delete mode 100644 etc/functions/mkcd delete mode 100644 etc/functions/world-readable (limited to 'etc') diff --git a/etc/.zshrc b/etc/.zshrc index 98a07d8..e6c5777 100644 --- a/etc/.zshrc +++ b/etc/.zshrc @@ -185,6 +185,38 @@ function ondemand powersave performance conservative userspace { sudo cpufreq-set -c 0 -g ${0} } +function extract { + if [[ -f ${1} ]] { + case ${1} in + *.tar*) tar xvf ${*} ;; + *.ace) unace e ${1} ;; + *.rar) unrar x ${1} ;; + *.deb) ar -x ${1} ;; + *.bz2) bunzip2 ${1} ;; + *.lzh) lha x ${1} ;; + *.gz) gunzip ${1} ;; + *.tar) tar xvf ${*} ;; + *.zip) unzip ${1} ;; + *.Z) uncompress ${1} ;; + *.cpio) cpio --no-absolute-filenames -idv < ${1} ;; + *.lzma) unlzma ${1} ;; + *) echo "Unknown archive type: ${1}"; return 2 ;; + esac + } else { + echo "No such file: ${1}" + return 1 + } +} + +function mkcd { + mkdir -p ${1} + cd ${1} +} + +function world-readable { + chmod -R a+rX . +} + # }}} # {{{ ZLE diff --git a/etc/functions/extract b/etc/functions/extract deleted file mode 100644 index 53fdc87..0000000 --- a/etc/functions/extract +++ /dev/null @@ -1,24 +0,0 @@ -## vim:ft=zsh -## Extract archives -## Usage: extr - -if [[ -f ${1} ]] { - case ${1} in - *.tar*) tar xvf ${*} ;; - *.ace) unace e ${1} ;; - *.rar) unrar x ${1} ;; - *.deb) ar -x ${1} ;; - *.bz2) bunzip2 ${1} ;; - *.lzh) lha x ${1} ;; - *.gz) gunzip ${1} ;; - *.tar) tar xvf ${*} ;; - *.zip) unzip ${1} ;; - *.Z) uncompress ${1} ;; - *.cpio) cpio --no-absolute-filenames -idv < ${1} ;; - *.lzma) unlzma ${1} ;; - *) echo "Unknown archive type: ${1}"; return 2 ;; - esac -} else { - echo "No such file: ${1}" - return 1 -} diff --git a/etc/functions/gtd-all b/etc/functions/gtd-all deleted file mode 100644 index e768ad7..0000000 --- a/etc/functions/gtd-all +++ /dev/null @@ -1,10 +0,0 @@ -## vim:ft=zsh -## concatenate all GTD databases -## usage: gtd-all [devtodo options] -typeset prefix=~/var/gtd -typeset database - -for database in ${prefix}/*(.N); { - echo "\n${database:t}" - todo --database ${database} ${*} -} diff --git a/etc/functions/gtd-move b/etc/functions/gtd-move deleted file mode 100644 index a20502c..0000000 --- a/etc/functions/gtd-move +++ /dev/null @@ -1,22 +0,0 @@ -## vim:ft=zsh -## Helper for my gtd system -## Usage: gtd-move -## Copyright (C) 2008 by Daniel Friesel -## License: WTFPL - -if [[ ${#*} != 3 ]] { - echo "Usage: gtd-move " - return -} - -typeset prefix="${HOME}/var/gtd" -typeset format='display=%T' -typeset from=${1} -typeset itemno=${2} -typeset to=${3} -typeset IFS=$'\n' -typeset -a item - -item=$(todo --database ${prefix}/${from} --format ${format} ${itemno}) -todo --database ${prefix}/${to} --priority medium --add ${item} -todo --database ${prefix}/${from} --remove ${itemno} diff --git a/etc/functions/hugin b/etc/functions/hugin deleted file mode 100644 index cf0aa9d..0000000 --- a/etc/functions/hugin +++ /dev/null @@ -1,3 +0,0 @@ -mkdir ~/tmp -MAKEFLAGS= command hugin -rm -rv ~/tmp diff --git a/etc/functions/mkcd b/etc/functions/mkcd deleted file mode 100644 index e91719a..0000000 --- a/etc/functions/mkcd +++ /dev/null @@ -1,13 +0,0 @@ -## vim:ft=zsh -## create a directory, then change into it -typeset -i ls=0 -typeset dir=${1} - -if [[ -z ${dir} ]] { - echo "Usage: mkcd " > /dev/stderr - return 1 -} -if [[ -d ${dir} ]] ls=1 -mkdir -p ${dir} -cd ${dir} -if ((ls)) ls --color=auto diff --git a/etc/functions/world-readable b/etc/functions/world-readable deleted file mode 100644 index 7963223..0000000 --- a/etc/functions/world-readable +++ /dev/null @@ -1 +0,0 @@ -chmod -R a+rX . -- cgit v1.2.3