#!/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() { local Vault=$1; shift local SubVaults=() test -n "$Vault" || usage test -e "$Vault" || die "vault does not exist: $Vault" test -d "$Vault" || die "vault is not a directory: $Vault" SubVaults=("$@") case $Action in init) dottum__make_links ;; explore) dottum__explore ;; *) usage ;; esac } export LC_ALL=C main() { local Action=init local ClobberLinks=false local ClobberBroken=true while true; do case $1 in -n) Action=explore; shift ;; -B) ClobberBroken=false; shift ;; -f) ClobberLinks=true; shift ;; *) break ;; esac done dottum__route "$@" } main "$@"