summaryrefslogtreecommitdiffstats
path: root/bin/dfen
blob: 6c3e588aff9a16069cee0a2080c2bcb30b8f2d73 (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"
done

# Clone repositories
mr checkout