Skip to content

Commit

Permalink
chore: update the message shown when the output directory exists (#931)
Browse files Browse the repository at this point in the history
Signed-off-by: Harikrishnan Balagopal <harikrishmenon@gmail.com>
  • Loading branch information
HarikrishnanBalagopal authored Dec 8, 2022
1 parent 6af1220 commit a77eb9c
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions cmd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,31 @@ func checkSourcePath(srcpath string) {
func checkOutputPath(outpath string, overwrite bool) {
fi, err := os.Stat(outpath)
if os.IsNotExist(err) {
logrus.Debugf("Transformed artifacts will be written to %s", outpath)
logrus.Debugf("Transformed artifacts will be written to a directory at path '%s'", outpath)
return
}
if err != nil {
logrus.Fatalf("Error while accessing output directory at path %s Error: %q . Exiting", outpath, err)
logrus.Fatalf("Error while accessing output directory at path '%s' Error: %q . Exiting", outpath, err)
}
if !overwrite {
logrus.Fatalf("Output directory %s exists. Exiting", outpath)
logrus.Fatalf(`The output directory '%s' already exists.
Please either:
- remove the output directory
- specify the '--%s' flag to overwrite the output directory
- use the '--%s' flag to specify a different output directory
Exiting.`, outpath, overwriteFlag, outputFlag)
}
if !fi.IsDir() {
logrus.Fatalf("Output path %s is a file. Expected a directory. Exiting", outpath)
logrus.Fatalf("Output path '%s' is a file. Expected a directory. Exiting", outpath)
}
pwd, err := os.Getwd()
if err != nil {
logrus.Fatalf("Failed to get the current working directory. Error: %q", err)
}
if common.IsParent(pwd, outpath) {
logrus.Fatalf("The given output directory %s is a parent of the current working directory.", outpath)
logrus.Fatalf("The given output directory '%s' is a parent of the current working directory.", outpath)
}
logrus.Infof("Output directory %s exists. The contents might get overwritten.", outpath)
logrus.Infof("Output directory '%s' exists. The contents might get overwritten.", outpath)
}

func startQA(flags qaflags) {
Expand Down

0 comments on commit a77eb9c

Please sign in to comment.