MCPcopy
hub / github.com/etcd-io/bbolt / newCompactCommand

Function newCompactCommand

cmd/bbolt/command/command_compact.go:20–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18}
19
20func newCompactCommand() *cobra.Command {
21 var o compactOptions
22 var compactCmd = &cobra.Command{
23 Use: "compact [options] -o <dst-bbolt-file> <src-bbolt-file>",
24 Short: "creates a compacted copy of the database from source path to the destination path, preserving the original.",
25 Long: `compact opens a database at source path and walks it recursively, copying keys
26as they are found from all buckets, to a newly created database at the destination path.
27The original database is left untouched.`,
28 Args: cobra.MinimumNArgs(1),
29 RunE: func(cmd *cobra.Command, args []string) error {
30 if err := o.Validate(args[0]); err != nil {
31 return err
32 }
33 return o.Run(cmd, args[0])
34 },
35 }
36 o.AddFlags(compactCmd.Flags())
37
38 return compactCmd
39}
40
41func (o *compactOptions) AddFlags(fs *pflag.FlagSet) {
42 fs.StringVarP(&o.dstPath, "output", "o", "", "")

Callers 1

NewRootCommandFunction · 0.85

Calls 4

ValidateMethod · 0.95
RunMethod · 0.95
AddFlagsMethod · 0.95
FlagsMethod · 0.45

Tested by

no test coverage detected