dotfiles/home/private_bin/executable_restic-othalan
2023-12-19 23:14:16 -06:00

32 lines
653 B
Bash

#!/usr/bin/env bash
set -a
source "$HOME/.config/restic/othalan.env"
declare -a flags
# if [[ "$1" == "backup" ]]; then
# flags=(
# "--exclude-file" "$HOME/.config/restic/excludes.txt"
# "--exclude-file" "$HOME/.conda/environments.txt"
# )
# fi
#
# echo "${flags[@]}"
# assumes subcommand always comes first
case $1 in
-*) restic "$@" && exit "$?";;
backup) cmd=backup; shift;;
*) cmd="$1"; shift;;
esac
if [[ $cmd == "backup" ]]; then
flags=(
"--exclude-file" "$HOME/.config/restic/excludes.txt"
"--exclude-file" "$HOME/.conda/environments.txt"
)
fi
# echo restic "$@" "${flags[@]}"
restic "$cmd" "${flags[@]}" "$@"