(args []string)
| 50 | } |
| 51 | |
| 52 | func (c *Command) Run(args []string) error { |
| 53 | ctx, cleanup, err := c.Init() |
| 54 | if err != nil { |
| 55 | return err |
| 56 | } |
| 57 | defer cleanup() |
| 58 | if len(args) != 1 { |
| 59 | return errors.New("create requires one argument") |
| 60 | } |
| 61 | db, err := c.DBFlags.Open(ctx) |
| 62 | if err != nil { |
| 63 | return err |
| 64 | } |
| 65 | sortKey, err := order.ParseSortKeys(c.sortKey) |
| 66 | if err != nil { |
| 67 | return err |
| 68 | } |
| 69 | poolName := args[0] |
| 70 | id, err := db.CreatePool(ctx, poolName, sortKey, int(c.seekStride), int64(c.thresh)) |
| 71 | if err != nil { |
| 72 | return err |
| 73 | } |
| 74 | if !c.DBFlags.Quiet { |
| 75 | fmt.Printf("pool created: %s %s\n", poolName, id) |
| 76 | } |
| 77 | if c.use { |
| 78 | if err := poolflags.WriteHead(poolName, "main"); err != nil { |
| 79 | return err |
| 80 | } |
| 81 | if !c.DBFlags.Quiet { |
| 82 | fmt.Printf("Switched to branch \"main\" on pool %q\n", poolName) |
| 83 | } |
| 84 | } |
| 85 | return nil |
| 86 | } |
nothing calls this directly
no test coverage detected