aboutsummaryrefslogtreecommitdiffstats
path: root/etc/linux-clean-tree.sh
blob: 80a858c35fd2f599285a36b730e62dc71c63e4bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash

# WARNING:
#
#       this script will delete *everything* that is not
#       under version control
#

POSITIONAL=()
CLEAN_ALL=false

while [[ $# -gt 0 ]]; do
    key="$1"

    case $key in
        -a|--all)
            CLEAN_ALL=true
            shift
            ;;
        *)
            POSITIONAL+=("$1")
            shift
            ;;
    esac
done

if [ "$CLEAN_ALL" = true ]; then
    git clean -d -x -f
else
    git clean -d -X -f
fi