Skip to content

Commit

Permalink
support custom file name in gitea dump command (#6474)
Browse files Browse the repository at this point in the history
* support custom file name in `gitea dump` command

* simpler approach to handle default dump file name
in `gitea dump` command
  • Loading branch information
glaszig authored and techknowlogick committed Apr 1, 2019
1 parent 2e1ead8 commit dbba46c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ It can be used for backup and capture Gitea server image to send to maintainer`,
Value: "custom/conf/app.ini",
Usage: "Custom configuration file path",
},
cli.StringFlag{
Name: "file, f",
Value: fmt.Sprintf("gitea-dump-%d.zip", time.Now().Unix()),
Usage: "Name of the dump file which will be created.",
},
cli.BoolFlag{
Name: "verbose, v",
Usage: "Show process details",
Expand Down Expand Up @@ -85,7 +90,7 @@ func runDump(ctx *cli.Context) error {

dbDump := path.Join(tmpWorkDir, "gitea-db.sql")

fileName := fmt.Sprintf("gitea-dump-%d.zip", time.Now().Unix())
fileName := ctx.String("file")
log.Printf("Packing dump files...")
z, err := zip.Create(fileName)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions docs/content/doc/usage/command-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ in the current directory.

- Options:
- `--config path`, `-c path`: Gitea configuration file path. Optional. (default: custom/conf/app.ini).
- `--file name`, `-f name`: Name of the dump file with will be created. Optional. (default: gitea-dump-[timestamp].zip).
- `--tempdir path`, `-t path`: Path to the temporary directory used. Optional. (default: /tmp).
- `--skip-repository`, `-R`: Skip the repository dumping. Optional.
- `--database`, `-d`: Specify the database SQL syntax. Optional.
Expand Down

0 comments on commit dbba46c

Please sign in to comment.