Skip to content

Commit 8495430

Browse files
Walzpierrelalanne
authored andcommitted
feat(output): Print the location of the output file
1 parent d1ad525 commit 8495430

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmd/src-fingerprint/main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"io"
66
"os"
7+
"path/filepath"
78
"srcfingerprint"
89
"srcfingerprint/cloner"
910
"srcfingerprint/exporter"
@@ -167,6 +168,7 @@ func mainAction(c *cli.Context) error {
167168
}
168169

169170
output := os.Stdout
171+
fsOutput := false
170172

171173
if c.String("output") != "-" {
172174
changedOutput, err := os.OpenFile(c.String("output"), os.O_RDWR|os.O_CREATE, os.ModePerm)
@@ -175,6 +177,7 @@ func mainAction(c *cli.Context) error {
175177
}
176178

177179
output = changedOutput
180+
fsOutput = true
178181

179182
defer output.Close()
180183
}
@@ -283,5 +286,11 @@ loop:
283286
}
284287

285288
log.Infoln("Done")
289+
290+
if fsOutput {
291+
path, _ := filepath.Abs(c.String("output"))
292+
fmt.Printf("Collected file hashes saved in file %s\n", path) // nolint
293+
}
294+
286295
return nil
287296
}

0 commit comments

Comments
 (0)