Skip to content

Commit

Permalink
Added CLI help to restore. #5
Browse files Browse the repository at this point in the history
  • Loading branch information
markfeit committed Jul 3, 2021
1 parent be15374 commit 4d443ed
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 18 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ activities are stored in `$DEST/var/log`. The latest logs or those
for a specific date can be retrieved and read with `$DEST/bin/logs`.


## Restoration
## Restoring Files

Files can be restored by executing `$DEST/bin/restore`. Full documentation is
(for now) in that file.
To restore files, execute `$DEST/bin/restore`. Detailed help may be
obtained with the `--help` switch.


## Maintenance
Expand Down
42 changes: 27 additions & 15 deletions bin/restore
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,37 @@
#
# Restore files from a backup
#
#BEGIN-HELP
#
# Usage:
#
# restore OPTIONS PATH [ PATH ... ]
# restore [ OPTIONS ] PATH [ PATH ... ]
#
# Where PATH is a path to a directory or file. If a PATH exists in
# the file system, it will be restored as its type (file or
# directory). If it does not exist, append a slash to force it to be
# treated as a directory. PATHs beginning with "+", "-", "i:" or "e:"
# will be passed directly to Duplicacy and used as filters.
# Where PATH is a path to a directory or file relative to the root of
# the backup set. If a PATH exists in the file system, it will be
# restored as its type (file or directory). If it does not exist,
# append a slash to force it to be treated as a directory. PATHs
# beginning with "+", "-", "i:" or "e:" will be passed directly to
# Duplicacy and used as filters.
#
# Options:
#
# --dest DIR Restore to DIR. DIR must be nonexistant or empty.
# --list List the snapshot times and exit
# --storage ID Use storage identified by ID (default is 'default')
# --time TIME An ISO 8601 timestamp indicating the desired time
# from which the file is to be restored. The default
# is the current time. (Example: 2018-06-13T17:50)
# --dest DIR Restore to DIR instead of their original location.
# DIR must be nonexistant or empty.
#
# If no --dest is supplied, the files will be restored relative to the
# root.
# --list List the times of all available snapshots in ISO
# 8601 format an exit without restoring anything and
# ignoring all other options except --storage.
#
# --storage ID Restore from the storage named ID. If not provided,
# files will be restored from "default".
#
# --time TIME Restore from the most-recent snapshot in the backup
# set that occurred before the ISO 8601 timestame TIME
# (e.g., 2021-07-03T08:30:00).
#
#END-HELP
#

. $(dirname $0)/common


Expand All @@ -40,6 +48,10 @@ do
ARG="$1"
shift
case "${ARG}" in
--help)
sed -n -e '/^#BEGIN-HELP/,${/^#BEGIN-HELP/d; /^#END-HELP/q; s/^#//; s/^ //; p}' "$0"
exit 0
;;
--dest)
DEST=$1
shift
Expand Down

0 comments on commit 4d443ed

Please sign in to comment.