summaryrefslogtreecommitdiffstats
path: root/bin/dfmk
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-03-05 03:03:20 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-03-05 03:03:20 (EST)
commitcbbf0a4ade85cb27e41a085ab740ae2e59e082c2 (patch)
treeaf88f743c8dae6c6b91d7e27fcf0f23295921e8e /bin/dfmk
parent20c36884281c9761831c653877ad0d9153dcf8ce (diff)
downloadmr-cbbf0a4ade85cb27e41a085ab740ae2e59e082c2.zip
mr-cbbf0a4ade85cb27e41a085ab740ae2e59e082c2.tar.gz
mr-cbbf0a4ade85cb27e41a085ab740ae2e59e082c2.tar.bz2
bin/dfmk, bin/dfen: New scripts
Diffstat (limited to 'bin/dfmk')
-rwxr-xr-xbin/dfmk27
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/dfmk b/bin/dfmk
new file mode 100755
index 0000000..4a87feb
--- /dev/null
+++ b/bin/dfmk
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+REPO_FMT='ssh://git@git.pehjota.net/dotfiles/%s.git'
+
+if [ ${#} -eq 0 ]; then
+ printf 'Usage: %s repository ...\n' "${0}" >&2
+ exit 1
+fi
+
+for repo in "${@}"; do
+ if ! [ "x$(vcsh "${repo}" status --porcelain | wc -l)" = 'x0' ]; then
+ printf 'Error: Repository %s has uncommited changes\n' "${repo}"
+ continue
+ fi
+
+ # Initialize repository
+ vcsh init "${repo}"
+ vcsh "${repo}" remote add origin "$(printf "${REPO_FMT}" "${repo}")"
+
+ # Add repository to mr.git
+ cat >"${HOME}/.config/mr/available.d/${repo}.vcsh" <<-EOF
+ [\$HOME/.config/vcsh/repo.d/${repo}.git]
+ checkout = vcsh clone $(printf "${REPO_FMT}" "${repo}") ${repo}
+ EOF
+ vcsh mr add "${HOME}/.config/mr/available.d/${repo}.vcsh"
+ vcsh mr commit -m "${repo}: New repository"
+done