From ac75d6724f1941ad03df4fe76276479fdf76f99a Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Fri, 8 Dec 2023 01:26:39 -0600 Subject: [PATCH] chore(restore): Check if file exists before prompting --- cmd/restore/restore.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/restore/restore.go b/cmd/restore/restore.go index 4ceb5c18..cbae371c 100644 --- a/cmd/restore/restore.go +++ b/cmd/restore/restore.go @@ -99,6 +99,12 @@ func preRun(cmd *cobra.Command, args []string) (err error) { return err } + if action.Filename != "-" { + if _, err := os.Stat(action.Filename); errors.Is(err, os.ErrNotExist) { + return err + } + } + if !action.Force { tty := term.TTY{In: os.Stdin}.IsTerminalIn() if tty {