mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
Add basic autocompletion (#3223)
* Add basic autocompletion * Add autocomplete to some common commands * Autocomplete the generate-root flags * Add information about autocomplete to the docs
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
colorable "github.com/mattn/go-colorable"
|
||||
log "github.com/mgutz/logxi/v1"
|
||||
testing "github.com/mitchellh/go-testing-interface"
|
||||
"github.com/posener/complete"
|
||||
|
||||
"google.golang.org/grpc/grpclog"
|
||||
|
||||
@@ -1200,6 +1201,20 @@ General Options:
|
||||
return strings.TrimSpace(helpText)
|
||||
}
|
||||
|
||||
func (c *ServerCommand) AutocompleteArgs() complete.Predictor {
|
||||
return complete.PredictNothing
|
||||
}
|
||||
|
||||
func (c *ServerCommand) AutocompleteFlags() complete.Flags {
|
||||
return complete.Flags{
|
||||
"-config": complete.PredictOr(complete.PredictFiles("*.hcl"), complete.PredictFiles("*.json")),
|
||||
"-dev": complete.PredictNothing,
|
||||
"-dev-root-token-id": complete.PredictNothing,
|
||||
"-dev-listen-address": complete.PredictNothing,
|
||||
"-log-level": complete.PredictSet("trace", "debug", "info", "warn", "err"),
|
||||
}
|
||||
}
|
||||
|
||||
// MakeShutdownCh returns a channel that can be used for shutdown
|
||||
// notifications for commands. This channel will send a message for every
|
||||
// SIGINT or SIGTERM received.
|
||||
|
||||
Reference in New Issue
Block a user