mirror of https://github.com/docker/cli.git
Use constants in completion of `--cgroupns`
Signed-off-by: Harald Albers <github@albersweb.de>
This commit is contained in:
parent
5624d2cbfd
commit
8362a23b67
|
@ -115,7 +115,7 @@ func addCompletions(cmd *cobra.Command, dockerCLI completion.APIClientProvider)
|
||||||
_ = cmd.RegisterFlagCompletionFunc("cap-add", completeLinuxCapabilityNames)
|
_ = cmd.RegisterFlagCompletionFunc("cap-add", completeLinuxCapabilityNames)
|
||||||
_ = cmd.RegisterFlagCompletionFunc("cap-drop", completeLinuxCapabilityNames)
|
_ = cmd.RegisterFlagCompletionFunc("cap-drop", completeLinuxCapabilityNames)
|
||||||
_ = cmd.RegisterFlagCompletionFunc("cgroup-parent", completion.NoComplete)
|
_ = cmd.RegisterFlagCompletionFunc("cgroup-parent", completion.NoComplete)
|
||||||
_ = cmd.RegisterFlagCompletionFunc("cgroupns", completion.FromList("host", "private"))
|
_ = cmd.RegisterFlagCompletionFunc("cgroupns", completeCgroupns())
|
||||||
_ = cmd.RegisterFlagCompletionFunc("cpu-period", completion.NoComplete)
|
_ = cmd.RegisterFlagCompletionFunc("cpu-period", completion.NoComplete)
|
||||||
_ = cmd.RegisterFlagCompletionFunc("cpu-quota", completion.NoComplete)
|
_ = cmd.RegisterFlagCompletionFunc("cpu-quota", completion.NoComplete)
|
||||||
_ = cmd.RegisterFlagCompletionFunc("cpu-rt-period", completion.NoComplete)
|
_ = cmd.RegisterFlagCompletionFunc("cpu-rt-period", completion.NoComplete)
|
||||||
|
@ -188,6 +188,10 @@ func addCompletions(cmd *cobra.Command, dockerCLI completion.APIClientProvider)
|
||||||
_ = cmd.RegisterFlagCompletionFunc("workdir", completion.NoComplete)
|
_ = cmd.RegisterFlagCompletionFunc("workdir", completion.NoComplete)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func completeCgroupns() completion.ValidArgsFn {
|
||||||
|
return completion.FromList(string(container.CgroupnsModeHost), string(container.CgroupnsModePrivate))
|
||||||
|
}
|
||||||
|
|
||||||
// completeDetachKeys implements shell completion for the `--detach-keys` option of `run` and `create`.
|
// completeDetachKeys implements shell completion for the `--detach-keys` option of `run` and `create`.
|
||||||
func completeDetachKeys(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
func completeDetachKeys(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||||
return []string{"ctrl-"}, cobra.ShellCompDirectiveNoSpace
|
return []string{"ctrl-"}, cobra.ShellCompDirectiveNoSpace
|
||||||
|
|
Loading…
Reference in New Issue