github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/cmd/pyroscope/command/dbmanager.go (about) 1 package command 2 3 import ( 4 "github.com/spf13/cobra" 5 6 "github.com/pyroscope-io/pyroscope/pkg/cli" 7 "github.com/pyroscope-io/pyroscope/pkg/config" 8 "github.com/pyroscope-io/pyroscope/pkg/dbmanager" 9 ) 10 11 func newDbManagerCmd(cfg *config.CombinedDbManager) *cobra.Command { 12 vpr := newViper() 13 dbmanagerCmd := &cobra.Command{ 14 Use: "dbmanager [flags] <args>", 15 Short: "Manage database", 16 Args: cobra.ExactArgs(1), // TODO: should be implemented as subcommands. 17 Hidden: true, 18 19 DisableFlagParsing: true, 20 RunE: cli.CreateCmdRunFn(cfg, vpr, func(_ *cobra.Command, args []string) error { 21 return dbmanager.Cli(cfg.DbManager, cfg.Server, args) 22 }), 23 } 24 25 cli.PopulateFlagSet(cfg.DbManager, dbmanagerCmd.Flags(), vpr) 26 cli.PopulateFlagSet(cfg.Server, dbmanagerCmd.Flags(), vpr, cli.WithSkip("log-level", "storage-path", "metrics-export-rules")) 27 return dbmanagerCmd 28 }