functions.zsh 1002 Bytes
Newer Older
1
2
function zsh_stats() {
  history | awk '{print $2}' | sort | uniq -c | sort -rn | head
Robby Russell's avatar
Robby Russell committed
3
4
5
6
}

function uninstall_oh_my_zsh() {
  /bin/sh $ZSH/tools/uninstall.sh
Robby Russell's avatar
Robby Russell committed
7
8
}

9
10
11
12
function upgrade_oh_my_zsh() {
  /bin/sh $ZSH/tools/upgrade.sh
}

Geoff Garside's avatar
Geoff Garside committed
13
14
15
16
function take() {
  mkdir -p $1
  cd $1
}
17
18

function extract() {
19
20
21
22
23
24
    unset REMOVE_ARCHIVE
    
    if test "$1" = "-r"; then
        REMOVE=1
        shift
    fi
25
26
27
28
  if [[ -f $1 ]]; then
    case $1 in
      *.tar.bz2) tar xvjf $1;;
      *.tar.gz) tar xvzf $1;;
SuprDewd's avatar
SuprDewd committed
29
30
      *.tar.xz) tar xvJf $1;;
      *.tar.lzma) tar --lzma -xvf $1;;
31
      *.bz2) bunzip $1;;
Lorenzo Manacorda's avatar
Lorenzo Manacorda committed
32
      *.rar) unrar x $1;;
33
34
35
36
37
38
39
40
41
      *.gz) gunzip $1;;
      *.tar) tar xvf $1;;
      *.tbz2) tar xvjf $1;;
      *.tgz) tar xvzf $1;;
      *.zip) unzip $1;;
      *.Z) uncompress $1;;
      *.7z) 7z x $1;;
      *) echo "'$1' cannot be extracted via >extract<";;
    esac
42
43
44
45
46
47

    if [[ $REMOVE_ARCHIVE -eq 1 ]]; then
        echo removing "$1";
        /bin/rm "$1";
    fi

48
49
50
51
  else
    echo "'$1' is not a valid file"
  fi
}
52