Restic config / aliases

I have quite a few shell aliases for restic. Programs like git has their own .gitconfig where you can define aliases. For instance, I have

[alias]
  ci = commit -a
  ls = ls-files
  st = status -sb

among others. It would be nice to have something similar for restic. Repo info etc could go in there too, as opposed to having environmental variables

We plan to add a configuration file (see #16), until then I’d suggest you write a small shell script to call restic which adds the parameters and environment variables you need and call it restic:

#!/bin/bash

export RESTIC_REPOSITORY=/tmp/repo
export RESTIC_PASSWORD=foo

case "$1" in
  jsnap)
    shift;
    /path/to/restic snapshots --json "$@"
  ;;
  *)
    /path/to/restic "$@"
  ;;
esac

We’re trying to keep the complexity implemented in restic under control, this reduces bugs and maintenance work. It feels to me that using the shell you can achieve what you want to do, so there’s no need to add this to restic.

1 Like