NewCmd creates the new cobra command
()
| 32 | |
| 33 | // NewCmd creates the new cobra command |
| 34 | func 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 | |
| 53 | func run() error { |
| 54 | fileNames, err := postgres.GetReadyWALFiles() |