MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / NewCmd

Function NewCmd

internal/cmd/manager/show/walarchivequeue/cmd.go:34–51  ·  view source on GitHub ↗

NewCmd creates the new cobra command

()

Source from the content-addressed store, hash-verified

32
33// NewCmd creates the new cobra command
34func NewCmd() *cobra.Command {
35 cmd := cobra.Command{
36 Use: "wal-archive-queue",
37 Short: "Lists all .ready wal files in " + specs.PgWalArchiveStatusPath,
38 RunE: func(cmd *cobra.Command, _ []string) error {
39 ctx := cmd.Context()
40 contextLogger := log.FromContext(ctx)
41
42 if err := run(); err != nil {
43 contextLogger.Error(err, "Error while extracting the list of .ready files")
44 }
45
46 return nil
47 },
48 }
49
50 return &cmd
51}
52
53func run() error {
54 fileNames, err := postgres.GetReadyWALFiles()

Callers 1

NewCmdFunction · 0.92

Calls 2

runFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected