dottum-install 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. . "$(sfpath)" || exit 3
  3. shellfu import pretty
  4. shellfu import dottum
  5. shellfu import saturnin
  6. usage() {
  7. mkusage "[options] VAULT [SUBVAULT]" \
  8. -o \
  9. "-n Do not do anything, just show what would be done" \
  10. "-B Do not replace broken link" \
  11. "-f Do not skip existing links"
  12. }
  13. dottum__route() {
  14. local Vault=$1; shift
  15. local SubVaults=()
  16. test -n "$Vault" || usage
  17. test -e "$Vault" || die "vault does not exist: $Vault"
  18. test -d "$Vault" || die "vault is not a directory: $Vault"
  19. SubVaults=("$@")
  20. case $Action in
  21. init) dottum__make_links ;;
  22. explore) dottum__explore ;;
  23. *) usage ;;
  24. esac
  25. }
  26. export LC_ALL=C
  27. main() {
  28. local Action=init
  29. local ClobberLinks=false
  30. local ClobberBroken=true
  31. while true; do case $1 in
  32. -n) Action=explore; shift ;;
  33. -B) ClobberBroken=false; shift ;;
  34. -f) ClobberLinks=true; shift ;;
  35. *) break ;;
  36. esac done
  37. dottum__route "$@"
  38. }
  39. main "$@"