| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | ) |
| 6 | |
| 7 | type AddCommand struct { |
| 8 | All bool `short:"a" long:"all" description:"Add all files"` |
| 9 | } |
| 10 | |
| 11 | var addCommand AddCommand |
| 12 | |
| 13 | func (x *AddCommand) Execute(args []string) error { |
| 14 | fmt.Printf("Adding (all=%v): %#v\n", x.All, args) |
| 15 | return nil |
| 16 | } |
| 17 | |
| 18 | func init() { |
| 19 | parser.AddCommand("add", |
| 20 | "Add a file", |
| 21 | "The add command adds a file to the repository. Use -a to add all files.", |
| 22 | &addCommand) |
| 23 | } |