Init sets up a Spread repository for versioning.
()
| 8 | |
| 9 | // Init sets up a Spread repository for versioning. |
| 10 | func (s SpreadCli) Init() *cli.Command { |
| 11 | return &cli.Command{ |
| 12 | Name: "init", |
| 13 | Usage: "spread init <path>", |
| 14 | Description: "Create a new spread repository in the given directory. If none is given, the working directory will be used.", |
| 15 | Action: func(c *cli.Context) { |
| 16 | target := c.Args().First() |
| 17 | if len(target) == 0 { |
| 18 | target = project.SpreadDirectory |
| 19 | } |
| 20 | |
| 21 | proj, err := project.InitProject(target) |
| 22 | if err != nil { |
| 23 | s.fatalf("Could not create Spread project: %v", err) |
| 24 | } |
| 25 | |
| 26 | s.printf("Created Spread repository in %s.", proj.Path) |
| 27 | }, |
| 28 | } |
| 29 | } |