mirror of
https://github.com/containers/podman.git
synced 2025-10-25 02:04:43 +08:00
Add completion for --init-ctr
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -906,6 +906,13 @@ func AutocompleteImageFormat(cmd *cobra.Command, args []string, toComplete strin
|
||||
return ImageFormat, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteInitCtr - Autocomplete init container type
|
||||
// -> "once", "always"
|
||||
func AutocompleteInitCtr(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
InitCtrType := []string{define.AlwaysInitContainer, define.OneShotInitContainer}
|
||||
return InitCtrType, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteCreateAttach - Autocomplete create --attach options.
|
||||
// -> "stdin", "stdout", "stderr"
|
||||
func AutocompleteCreateAttach(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
|
||||
@ -8,7 +8,6 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/containers/common/pkg/completion"
|
||||
"github.com/containers/common/pkg/config"
|
||||
cutil "github.com/containers/common/pkg/util"
|
||||
"github.com/containers/image/v5/transports/alltransports"
|
||||
@ -69,6 +68,7 @@ func createFlags(cmd *cobra.Command) {
|
||||
initContainerFlagName, "",
|
||||
"Make this a pod init container.",
|
||||
)
|
||||
_ = cmd.RegisterFlagCompletionFunc(initContainerFlagName, common.AutocompleteInitCtr)
|
||||
|
||||
flags.SetInterspersed(false)
|
||||
common.DefineCreateDefaults(&cliVals)
|
||||
@ -86,8 +86,6 @@ func createFlags(cmd *cobra.Command) {
|
||||
|
||||
_ = flags.MarkHidden("pidfile")
|
||||
}
|
||||
|
||||
_ = cmd.RegisterFlagCompletionFunc(initContainerFlagName, completion.AutocompleteDefault)
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
Reference in New Issue
Block a user