From e87b8825cbde32e984faa18f09ef1bfea1a02452 Mon Sep 17 00:00:00 2001 From: Ronan Weinberg Waks Date: Tue, 29 Aug 2023 15:20:01 -0500 Subject: [PATCH] Update main.go --- gcs-fetcher/cmd/gcs-fetcher/main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gcs-fetcher/cmd/gcs-fetcher/main.go b/gcs-fetcher/cmd/gcs-fetcher/main.go index f9704824f..cf3163ab5 100644 --- a/gcs-fetcher/cmd/gcs-fetcher/main.go +++ b/gcs-fetcher/cmd/gcs-fetcher/main.go @@ -33,7 +33,6 @@ import ( ) const ( - stagingFolder = ".download/" userAgent = "gcs-fetcher" ) @@ -48,6 +47,9 @@ var ( backoff = flag.Duration("backoff", 100*time.Millisecond, "Time to wait when retrying, will be doubled on each retry.") timeoutGCS = flag.Bool("timeout_gcs", true, "If true, a timeout will be used to avoid GCS longtails.") help = flag.Bool("help", false, "If true, prints help text and exits.") + + keepSource = flag.Bool("keep_source", false, "If true, keeps the source file in the file system.") + stagingFolder = flag.String("staging_folder", ".download/", "Temp folder where to download the source file.") ) func logFatalf(writer io.Writer, format string, a ...interface{}) { @@ -103,7 +105,7 @@ func main() { GCS: realGCS{client}, OS: realOS{}, DestDir: *destDir, - StagingDir: filepath.Join(*destDir, stagingFolder), + StagingDir: filepath.Join(*destDir, *stagingFolder), CreatedDirs: map[string]bool{}, Bucket: bucket, Object: object, @@ -113,6 +115,7 @@ func main() { Retries: *retries, Backoff: *backoff, SourceType: *sourceType, + KeepSource: *keepSource, Verbose: *verbose, Stdout: stdout, Stderr: stderr,