Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion shell/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ func RunArgs(args []string, onError flag.ErrorHandling) error {
if err != nil {
absPath = outFileName
}
log.Print("downloaded: ", absPath)
if res.OutputWritten {
log.Print("downloaded: ", absPath)
} else {
log.Print("already exists: ", absPath)
}
return nil
}

Expand All @@ -40,6 +44,7 @@ func parseSpec(args []string, onError flag.ErrorHandling) (download.Spec, error)
version := fs.String("version", spec.Version, "DuckDB version")
binOS := fs.String("os", spec.OS, "target OS")
binArch := fs.String("arch", spec.Arch, "target architecture")
binOverwrite := fs.Bool("overwrite", true, "overwrite existing file")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The default value for the overwrite flag is set to true. This is a potentially destructive default, as it could lead to users accidentally overwriting files. It's standard practice for operations that can overwrite data to be opt-in.

The default should be false to prevent accidental data loss. The user can then explicitly enable it by passing -overwrite or -overwrite=true.

Suggested change
binOverwrite := fs.Bool("overwrite", true, "overwrite existing file")
binOverwrite := fs.Bool("overwrite", false, "overwrite existing file")

if err := fs.Parse(args[1:]); err != nil {
return download.Spec{}, err
}
Expand All @@ -48,5 +53,6 @@ func parseSpec(args []string, onError flag.ErrorHandling) (download.Spec, error)
spec.Version = *version
spec.OS = *binOS
spec.Arch = *binArch
spec.Overwrite = *binOverwrite
return spec, nil
}