sspt-clean 626 Bytes
Newer Older
PoroCYon's avatar
PoroCYon committed
1
2
3
#!/usr/bin/env bash

print_help() {
pcy's avatar
stuff    
pcy committed
4
    >&2 cat <<EOF
PoroCYon's avatar
PoroCYon committed
5
Clean a package.
PoroCYon's avatar
PoroCYon committed
6
Usage: sspt clean [-h|-?|--help]
PoroCYon's avatar
PoroCYon committed
7
           Print this help text and exit.
PoroCYon's avatar
PoroCYon committed
8
     - sspt clean <package-name>
PoroCYon's avatar
PoroCYon committed
9
10
11
12
13
           Clean the package.
EOF
}

main() {
PoroCYon's avatar
fix _    
PoroCYon committed
14
15
    case "$1" in
        "-h"|"-?"|"--help")
PoroCYon's avatar
PoroCYon committed
16
17
18
            print_help
            ;;
        *)
19
            if ! exec_subcommand src-db exists "$1"; then
PoroCYon's avatar
PoroCYon committed
20
                (>&2 echo "Package '$1' doesn't exist.")
PoroCYon's avatar
PoroCYon committed
21
22
23
                exit 1
            fi
            exec_subcommand pkgcmd clean "$1"
pcy's avatar
pcy committed
24
            exit $?
PoroCYon's avatar
PoroCYon committed
25
26
27
28
29
30
31
32
33
            ;;
    esac
}

if [ $# -eq 0 ]; then
    print_help
    exit
fi

34
main "$@"
PoroCYon's avatar
PoroCYon committed
35