add.go 417 B

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