use a simpler restore flag

This commit is contained in:
cupcakearmy 2019-12-04 20:50:32 +01:00
parent 417c54db4d
commit 18c3f4a06f

View File

@ -85,6 +85,11 @@ const handlers: Handlers = {
if (!config) throw ConfigError if (!config) throw ConfigError
checkIfResticIsAvailable() checkIfResticIsAvailable()
if(!flags.to) {
console.log(`You need to specify the restore path with --to`.red)
return
}
const locations = parseLocations(flags) const locations = parseLocations(flags)
for (const [name, location] of Object.entries(locations)) { for (const [name, location] of Object.entries(locations)) {
const baseText = name.green + '\t\t' const baseText = name.green + '\t\t'
@ -105,7 +110,7 @@ const handlers: Handlers = {
exec( exec(
'restic', 'restic',
['restore', 'latest', '--path', resolve(location.from), ...args], ['restore', 'latest', '--path', resolve(location.from), '--target', flags.to],
{ env }, { env },
) )
w.done(name.green + '\t\tDone 🎉') w.done(name.green + '\t\tDone 🎉')
@ -240,7 +245,7 @@ export const help = () => {
'\n check [-b, --backend] [-a, --all] Check backends' + '\n check [-b, --backend] [-a, --all] Check backends' +
'\n backup [-l, --location] [-a, --all] Backup all or specified locations' + '\n backup [-l, --location] [-a, --all] Backup all or specified locations' +
'\n forget [-l, --location] [-a, --all] [--dry-run] Forget old snapshots according to declared policies' + '\n forget [-l, --location] [-a, --all] [--dry-run] Forget old snapshots according to declared policies' +
'\n restore [-l, --location] [--from backend] [-- --target <out dir>] Restore all or specified locations' + '\n restore [-l, --location] [--from backend] [--to <out dir>] Restore all or specified locations' +
'\n' + '\n' +
'\n exec [-b, --backend] [-a, --all] <command> -- [native options] Execute native restic command' + '\n exec [-b, --backend] [-a, --all] <command> -- [native options] Execute native restic command' +
'\n' + '\n' +