2024-08-23 10:50:53 +02:00
|
|
|
import strutils
|
|
|
|
import strformat
|
|
|
|
|
|
|
|
import ../model/command_type
|
|
|
|
import ../utils/run
|
|
|
|
export run
|
|
|
|
|
2024-08-23 13:04:27 +02:00
|
|
|
proc genCommand*(cmd: string, repo: string, further_args: seq[string]): string =
|
|
|
|
let args = further_args.join(" ")
|
2024-08-23 11:30:36 +02:00
|
|
|
let cmd = fmt"{RESTIC_BIN} {cmd} -r {repo} {args}"
|
2024-08-23 10:50:53 +02:00
|
|
|
return cmd
|
|
|
|
|
2024-08-23 13:31:43 +02:00
|
|
|
proc genRestoreCommand*(cmd: string, repo_snapshot: string, destination: string, further_args: seq[string]): string =
|
|
|
|
let args = further_args.join(" ")
|
|
|
|
let cmd = fmt"{RESTIC_BIN} {cmd} -r {repo_snapshot} --target {destination} {args}"
|
|
|
|
return cmd
|
|
|
|
|