You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

35 lines
614 B

  1. // Copyright 2013 The Go Authors. All rights reserved.
  2. //
  3. // Use of this source code is governed by a BSD-style
  4. // license that can be found in the LICENSE file or at
  5. // https://developers.google.com/open-source/licenses/bsd.
  6. package main
  7. import (
  8. "log"
  9. "os"
  10. "github.com/golang/gddo/database"
  11. )
  12. var deleteCommand = &command{
  13. name: "delete",
  14. run: del,
  15. usage: "delete path",
  16. }
  17. func del(c *command) {
  18. if len(c.flag.Args()) != 1 {
  19. c.printUsage()
  20. os.Exit(1)
  21. }
  22. db, err := database.New()
  23. if err != nil {
  24. log.Fatal(err)
  25. }
  26. if err := db.Delete(c.flag.Args()[0]); err != nil {
  27. log.Fatal(err)
  28. }
  29. }