Skip to content

Commit

Permalink
chore(restore): Check if file exists before prompting
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Dec 8, 2023
1 parent 93241b2 commit ac75d67
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/restore/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ac75d67

Please sign in to comment.