summaryrefslogtreecommitdiffstats
path: root/remove-plugins
blob: bb086c63c21fd8891b876a6bb4d42ee517d46dce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

set -euo pipefail
IFS=$'\n\t'

for plugin in "$@"; do
    if ! [[ -e "$plugin" ]]; then
        plugin="bundle/$plugin"
    fi
    if ! [[ -e "$plugin" ]]; then
        echo "Plugin \"$plugin\" does not exist!" >&2
        exit 1
    fi
    if ! [[ -d "$plugin" ]]; then
        echo "\"$plugin\" is not a directory!" >&2
        exit 1
    fi
    git submodule deinit "$plugin" ||:
    git rm "$plugin" ||:
    git rm --cached "$plugin" ||:
    rm -rf ".git/modules/$plugin" ||:
done