open-vault/commands.go

82 lines
1.4 KiB
Go
Raw Normal View History

2015-03-04 07:03:24 +00:00
package main
import (
"os"
"github.com/hashicorp/vault/command"
"github.com/mitchellh/cli"
)
// Commands is the mapping of all the available Consul commands.
var Commands map[string]cli.CommandFactory
func init() {
2015-03-04 07:34:32 +00:00
ui := &cli.BasicUi{
Writer: os.Stdout,
ErrorWriter: os.Stderr,
}
meta := command.Meta{Ui: ui}
2015-03-04 07:03:24 +00:00
Commands = map[string]cli.CommandFactory{
2015-03-04 07:34:32 +00:00
"auth": func() (cli.Command, error) {
return &command.AuthCommand{
Meta: meta,
}, nil
},
2015-03-04 19:08:13 +00:00
"get": func() (cli.Command, error) {
return &command.GetCommand{
Meta: meta,
}, nil
},
2015-03-04 07:34:32 +00:00
2015-03-04 19:08:13 +00:00
"put": func() (cli.Command, error) {
return &command.PutCommand{
Meta: meta,
}, nil
},
2015-03-04 07:34:32 +00:00
2015-03-04 16:56:10 +00:00
"seal": func() (cli.Command, error) {
return &command.SealCommand{
Meta: meta,
}, nil
},
2015-03-04 07:57:23 +00:00
"unseal": func() (cli.Command, error) {
return &command.UnsealCommand{
Meta: meta,
}, nil
},
2015-03-13 17:32:39 +00:00
"init": func() (cli.Command, error) {
return &command.InitCommand{
Meta: meta,
}, nil
},
2015-03-12 22:21:11 +00:00
"server": func() (cli.Command, error) {
return &command.ServerCommand{
Meta: meta,
}, nil
},
2015-03-04 07:03:24 +00:00
"version": func() (cli.Command, error) {
ver := Version
rel := VersionPrerelease
if GitDescribe != "" {
ver = GitDescribe
}
if GitDescribe == "" && rel == "" {
rel = "dev"
}
return &command.VersionCommand{
Revision: GitCommit,
Version: ver,
VersionPrerelease: rel,
Ui: ui,
}, nil
},
}
}