From 8ce23e2c7153aeea2f44cd0355511130bdb5f285 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Thu, 23 Mar 2017 18:44:24 -0400 Subject: [PATCH] cmd/backup: able to specify archive name (#4320) Added flag '--archive-name' for backup command. --- cmd/backup.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/backup.go b/cmd/backup.go index 6f5cb899d..f5911455d 100644 --- a/cmd/backup.go +++ b/cmd/backup.go @@ -33,6 +33,7 @@ portable among all supported database engines.`, boolFlag("verbose, v", "Show process details"), stringFlag("tempdir, t", os.TempDir(), "Temporary directory path"), stringFlag("target", "./", "Target directory path to save backup archive"), + stringFlag("archive-name", fmt.Sprintf("gogs-backup-%d.zip", time.Now().Unix()), "Name of backup archive"), boolFlag("database-only", "Only dump database"), boolFlag("exclude-repos", "Exclude repositories"), }, @@ -69,7 +70,7 @@ func runBackup(c *cli.Context) error { log.Fatal(0, "Fail to save metadata '%s': %v", metaFile, err) } - archiveName := path.Join(c.String("target"), fmt.Sprintf("gogs-backup-%d.zip", time.Now().Unix())) + archiveName := path.Join(c.String("target"), c.String("archive-name")) log.Info("Packing backup files to: %s", archiveName) z, err := zip.Create(archiveName)