aboutsummaryrefslogtreecommitdiff
path: root/bin/repos
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2022-10-27 22:54:34 -0300
committerEuAndreh <eu@euandre.org>2022-10-27 22:54:34 -0300
commit8af3b16bb72b192b5a5bb2138447ec8893d1ff53 (patch)
tree626dee9fd9b0c402dde2813d5f7291be697b5b48 /bin/repos
parentbin/vcs: Do not require TYPE, and guess it instead (diff)
downloaddotfiles-8af3b16bb72b192b5a5bb2138447ec8893d1ff53.tar.gz
dotfiles-8af3b16bb72b192b5a5bb2138447ec8893d1ff53.tar.xz
bin/repos: Simplify, using the new vcs(1)
Diffstat (limited to 'bin/repos')
-rwxr-xr-xbin/repos23
1 files changed, 5 insertions, 18 deletions
diff --git a/bin/repos b/bin/repos
index 1e764ca..32fe1cd 100755
--- a/bin/repos
+++ b/bin/repos
@@ -131,26 +131,13 @@ shift $((OPTIND - 1))
is_repository() {
- if [ -e "$1"/.git ]; then
- printf 'git:%s\n' "$1"
- return 0
- elif [ -e "$1"/.hg ]; then
- printf 'mercurial:%s\n' "$1"
- return 0
- elif [ -e "$1"/.bk ]; then
- printf 'bitkeeper:%s\n' "$1"
- return 0
- elif [ -e "$1"/_darcs ]; then
- printf 'darcs:%s\n' "$1"
- return 0
- elif [ -e "$1"/CVS/ ]; then
- printf 'cvs:%s\n' "$1"
- return 0
- elif [ -e "$1"/.fslckout ]; then
- printf 'fossil:%s\n' "$1"
+ TYPE="$(vcs -C "$1" -t)"
+ if [ -n "$TYPE" ]; then
+ printf '%s:%s\n' "$TYPE" "$1"
return 0
+ else
+ return 1
fi
- return 1
}