inspect: add shell-completion for "--type" flag
With this patch: docker inspect --type <TAB> config image node secret task container network plugin service volume Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
877ea1ce35
commit
7203340f53
@ -39,6 +39,19 @@ const (
|
||||
typeVolume objectType = "volume"
|
||||
)
|
||||
|
||||
var allTypes = []objectType{
|
||||
typeConfig,
|
||||
typeContainer,
|
||||
typeImage,
|
||||
typeNetwork,
|
||||
typeNode,
|
||||
typePlugin,
|
||||
typeSecret,
|
||||
typeService,
|
||||
typeTask,
|
||||
typeVolume,
|
||||
}
|
||||
|
||||
type inspectOptions struct {
|
||||
format string
|
||||
objectType objectType
|
||||
@ -67,6 +80,7 @@ func NewInspectCommand(dockerCli command.Cli) *cobra.Command {
|
||||
flags.StringVar(&opts.objectType, "type", "", "Return JSON for specified type")
|
||||
flags.BoolVarP(&opts.size, "size", "s", false, "Display total file sizes if the type is container")
|
||||
|
||||
_ = cmd.RegisterFlagCompletionFunc("type", completion.FromList(allTypes...))
|
||||
flags.VisitAll(func(flag *pflag.Flag) {
|
||||
// Set a default completion function if none was set. We don't look
|
||||
// up if it does already have one set, because Cobra does this for
|
||||
|
Loading…
x
Reference in New Issue
Block a user