123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #!/bin/bash
-
- . "$(sfpath)" || exit 3
-
- shellfu import pretty
-
- shellfu import dottum
- shellfu import saturnin
-
- usage() {
- mkusage "$@" "[options] VAULT [SUBVAULT]" \
- -o \
- "-n Do not do anything, just show what would be done" \
- "-B Do not replace broken link" \
- "-f Do not skip existing links"
- }
-
- dottum__route() {
- DOTTUM__VAULT=$1; shift
- local DOTTUM__SUBVAULTS=()
- test -n "$DOTTUM__VAULT" || usage -w "no VAULT?"
- test -e "$DOTTUM__VAULT" || die "vault does not exist: $DOTTUM__VAULT"
- test -d "$DOTTUM__VAULT" || die "vault is not a directory: $DOTTUM__VAULT"
- DOTTUM__SUBVAULTS=("$@")
- case $Action in
- init) dottum__make_links ;;
- explore) dottum__explore ;;
- *) saturnin__bug "bad Action: $Action" ;;
- esac
- }
- export LC_ALL=C
-
- main() {
- local Action=init
- while true; do case $1 in
- -n) Action=explore; shift ;;
- -B) DOTTUM__CLOBBER_BROKEN=false; shift ;;
- -f) DOTTUM__CLOBBER_LINKS=true; shift ;;
- -*) usage -w "unknown argument: $1" ;;
- *) break ;;
- esac done
- dottum__route "$@"
- }
-
- main "$@"
|