mirror of
https://github.com/containers/podman.git
synced 2025-10-26 02:35: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
|
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.
|
// AutocompleteCreateAttach - Autocomplete create --attach options.
|
||||||
// -> "stdin", "stdout", "stderr"
|
// -> "stdin", "stdout", "stderr"
|
||||||
func AutocompleteCreateAttach(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
func AutocompleteCreateAttach(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containers/common/pkg/completion"
|
|
||||||
"github.com/containers/common/pkg/config"
|
"github.com/containers/common/pkg/config"
|
||||||
cutil "github.com/containers/common/pkg/util"
|
cutil "github.com/containers/common/pkg/util"
|
||||||
"github.com/containers/image/v5/transports/alltransports"
|
"github.com/containers/image/v5/transports/alltransports"
|
||||||
@ -69,6 +68,7 @@ func createFlags(cmd *cobra.Command) {
|
|||||||
initContainerFlagName, "",
|
initContainerFlagName, "",
|
||||||
"Make this a pod init container.",
|
"Make this a pod init container.",
|
||||||
)
|
)
|
||||||
|
_ = cmd.RegisterFlagCompletionFunc(initContainerFlagName, common.AutocompleteInitCtr)
|
||||||
|
|
||||||
flags.SetInterspersed(false)
|
flags.SetInterspersed(false)
|
||||||
common.DefineCreateDefaults(&cliVals)
|
common.DefineCreateDefaults(&cliVals)
|
||||||
@ -86,8 +86,6 @@ func createFlags(cmd *cobra.Command) {
|
|||||||
|
|
||||||
_ = flags.MarkHidden("pidfile")
|
_ = flags.MarkHidden("pidfile")
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = cmd.RegisterFlagCompletionFunc(initContainerFlagName, completion.AutocompleteDefault)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|||||||
Reference in New Issue
Block a user