From 4868964bb99facd8cc6149626023e64db14a6742 Mon Sep 17 00:00:00 2001 From: Elad Date: Fri, 12 Oct 2018 14:51:38 +0200 Subject: cmd/swarm: split flags and cli command declarations to the relevant files (#17896) --- cmd/swarm/db.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'cmd/swarm/db.go') diff --git a/cmd/swarm/db.go b/cmd/swarm/db.go index 107fbf100..7916beffc 100644 --- a/cmd/swarm/db.go +++ b/cmd/swarm/db.go @@ -29,6 +29,48 @@ import ( "gopkg.in/urfave/cli.v1" ) +var dbCommand = cli.Command{ + Name: "db", + CustomHelpTemplate: helpTemplate, + Usage: "manage the local chunk database", + ArgsUsage: "db COMMAND", + Description: "Manage the local chunk database", + Subcommands: []cli.Command{ + { + Action: dbExport, + CustomHelpTemplate: helpTemplate, + Name: "export", + Usage: "export a local chunk database as a tar archive (use - to send to stdout)", + ArgsUsage: " ", + Description: ` +Export a local chunk database as a tar archive (use - to send to stdout). + + swarm db export ~/.ethereum/swarm/bzz-KEY/chunks chunks.tar + +The export may be quite large, consider piping the output through the Unix +pv(1) tool to get a progress bar: + + swarm db export ~/.ethereum/swarm/bzz-KEY/chunks - | pv > chunks.tar +`, + }, + { + Action: dbImport, + CustomHelpTemplate: helpTemplate, + Name: "import", + Usage: "import chunks from a tar archive into a local chunk database (use - to read from stdin)", + ArgsUsage: " ", + Description: `Import chunks from a tar archive into a local chunk database (use - to read from stdin). + + swarm db import ~/.ethereum/swarm/bzz-KEY/chunks chunks.tar + +The import may be quite large, consider piping the input through the Unix +pv(1) tool to get a progress bar: + + pv chunks.tar | swarm db import ~/.ethereum/swarm/bzz-KEY/chunks -`, + }, + }, +} + func dbExport(ctx *cli.Context) { args := ctx.Args() if len(args) != 3 { -- cgit v1.2.3