main.go 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright 2015 CoreOS, Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // etcdctl is a command line application that controls etcd.
  15. package main
  16. import (
  17. "os"
  18. "time"
  19. "github.com/coreos/etcd/Godeps/_workspace/src/github.com/codegangsta/cli"
  20. "github.com/coreos/etcd/etcdctl/command"
  21. "github.com/coreos/etcd/version"
  22. )
  23. func main() {
  24. app := cli.NewApp()
  25. app.Name = "etcdctl"
  26. app.Version = version.Version
  27. app.Usage = "A simple command line client for etcd."
  28. app.Flags = []cli.Flag{
  29. cli.BoolFlag{Name: "debug", Usage: "output cURL commands which can be used to reproduce the request"},
  30. cli.BoolFlag{Name: "no-sync", Usage: "don't synchronize cluster information before sending request"},
  31. cli.StringFlag{Name: "output, o", Value: "simple", Usage: "output response in the given format (`simple`, `extended` or `json`)"},
  32. cli.StringFlag{Name: "discovery-srv, D", Usage: "domain name to query for SRV records describing cluster endpoints"},
  33. cli.StringFlag{Name: "peers, C", Value: "", Usage: "DEPRECATED - \"--endpoints\" should be used instead"},
  34. cli.StringFlag{Name: "endpoint", Value: "", Usage: "DEPRECATED - \"--endpoints\" should be used instead"},
  35. cli.StringFlag{Name: "endpoints", Value: "", Usage: "a comma-delimited list of machine addresses in the cluster (default: \"http://127.0.0.1:2379,http://127.0.0.1:4001\")"},
  36. cli.StringFlag{Name: "cert-file", Value: "", Usage: "identify HTTPS client using this SSL certificate file"},
  37. cli.StringFlag{Name: "key-file", Value: "", Usage: "identify HTTPS client using this SSL key file"},
  38. cli.StringFlag{Name: "ca-file", Value: "", Usage: "verify certificates of HTTPS-enabled servers using this CA bundle"},
  39. cli.StringFlag{Name: "username, u", Value: "", Usage: "provide username[:password] and prompt if password is not supplied."},
  40. cli.DurationFlag{Name: "timeout", Value: time.Second, Usage: "connection timeout per request"},
  41. cli.DurationFlag{Name: "total-timeout", Value: 5 * time.Second, Usage: "timeout for the command execution (except watch)"},
  42. }
  43. app.Commands = []cli.Command{
  44. command.NewBackupCommand(),
  45. command.NewClusterHealthCommand(),
  46. command.NewMakeCommand(),
  47. command.NewMakeDirCommand(),
  48. command.NewRemoveCommand(),
  49. command.NewRemoveDirCommand(),
  50. command.NewGetCommand(),
  51. command.NewLsCommand(),
  52. command.NewSetCommand(),
  53. command.NewSetDirCommand(),
  54. command.NewUpdateCommand(),
  55. command.NewUpdateDirCommand(),
  56. command.NewWatchCommand(),
  57. command.NewExecWatchCommand(),
  58. command.NewMemberCommand(),
  59. command.NewImportSnapCommand(),
  60. command.NewUserCommands(),
  61. command.NewRoleCommands(),
  62. command.NewAuthCommands(),
  63. }
  64. app.Run(os.Args)
  65. }