1package main 2 3import ( 4 "fmt" 5) 6 7type AddCommand struct { 8 All bool `short:"a" long:"all" description:"Add all files"` 9} 10 11var addCommand AddCommand 12 13func (x *AddCommand) Execute(args []string) error { 14 fmt.Printf("Adding (all=%v): %#v\n", x.All, args) 15 return nil 16} 17 18func 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} 24