Skip to content

Commit

Permalink
Added delete flag for etcd-import
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Persson committed Sep 21, 2015
1 parent 29faa21 commit 4a22692
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/github.com/mickep76/etcd-import/etcd-import.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func main() {

// Options.
version := flag.Bool("version", false, "Version")
delete := flag.Bool("delete", false, "Delete entry before import")
node := flag.String("node", "", "Etcd node")
port := flag.String("port", "2379", "Etcd port")
dir := flag.String("dir", "/", "Etcd directory")
Expand Down Expand Up @@ -74,6 +75,10 @@ func main() {
log.Fatal("No input provided")
}

if *delete {
client.Delete(strings.TrimRight(*dir, "/"), true)
}

if err = etcdmap.Create(client, strings.TrimRight(*dir, "/"), reflect.ValueOf(m)); err != nil {
log.Fatal(err.Error())
}
Expand Down

0 comments on commit 4a22692

Please sign in to comment.