Commit sets up a Spread repository for versioning.
()
| 10 | |
| 11 | // Commit sets up a Spread repository for versioning. |
| 12 | func (s SpreadCli) Commit() *cli.Command { |
| 13 | return &cli.Command{ |
| 14 | Name: "commit", |
| 15 | Usage: "spread commit -m <msg>", |
| 16 | Description: "Create new commit based on the current index", |
| 17 | Flags: []cli.Flag{ |
| 18 | cli.StringFlag{ |
| 19 | Name: "m", |
| 20 | Usage: "Message to store the commit with", |
| 21 | }, |
| 22 | }, |
| 23 | Action: func(c *cli.Context) { |
| 24 | msg := c.String("m") |
| 25 | if len(msg) == 0 { |
| 26 | s.fatalf("All commits must have a message. Specify one with 'spread commit -m \"message\"'") |
| 27 | } |
| 28 | |
| 29 | proj := s.projectOrDie() |
| 30 | notImplemented := project.Person{ |
| 31 | Name: "not implemented", |
| 32 | Email: "not@implemented.com", |
| 33 | When: time.Now(), |
| 34 | } |
| 35 | |
| 36 | oid, err := proj.Commit("HEAD", notImplemented, notImplemented, msg) |
| 37 | if err != nil { |
| 38 | s.fatalf("Could not commit: %v", err) |
| 39 | } |
| 40 | |
| 41 | s.printf("New commit: [%s] %s", oid, msg) |
| 42 | }, |
| 43 | } |
| 44 | } |
nothing calls this directly
no test coverage detected