summaryrefslogtreecommitdiffstats
path: root/bin/dfen
blob: 3cf4aeff05ff613f02c7bde26c37eb35e7db88f3 (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
#!/bin/sh

if [ ${#} -eq 0 ]; then
	printf 'Usage: %s repository ...\n' "${0}" >&2
	exit 1
fi

for repo in "${@}"; do
	if ! [ -f "${HOME}/.config/mr/available.d/${repo}.vcsh" ]; then
		printf 'Error: %s: No such repository\n' "${repo}" >&2
		continue
	fi
	if [ -f "${HOME}/.config/mr/config.d/${repo}.vcsh" ]; then
		printf 'Warning: %s: Already enabled\n' "${repo}" >&2
		continue
	fi

	# Enable repository in mr configuration
	ln -s "../available.d/${repo}.vcsh" \
		"${HOME}/.config/mr/config.d/${repo}.vcsh"

	# Clone repository
	mr checkout
done