Rename AutocompletePortCommand func

This function is now used for the port and rename command.
Rename it to AutocompleteContainerOneArg.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
This commit is contained in:
Paul Holzinger
2021-01-16 18:54:59 +01:00
parent 83ed464d29
commit 47eeb02c7a
3 changed files with 4 additions and 4 deletions

View File

@ -517,8 +517,8 @@ func AutocompleteRunlabelCommand(cmd *cobra.Command, args []string, toComplete s
return nil, cobra.ShellCompDirectiveDefault
}
// AutocompletePortCommand - Autocomplete podman port command args.
func AutocompletePortCommand(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
// AutocompleteContainerOneArg - Autocomplete containers as fist arg.
func AutocompleteContainerOneArg(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if !validCurrentCmdLine(cmd, args, toComplete) {
return nil, cobra.ShellCompDirectiveNoFileComp
}

View File

@ -26,7 +26,7 @@ var (
Args: func(cmd *cobra.Command, args []string) error {
return validate.CheckAllLatestAndCIDFile(cmd, args, true, false)
},
ValidArgsFunction: common.AutocompletePortCommand,
ValidArgsFunction: common.AutocompleteContainerOneArg,
Example: `podman port --all
podman port ctrID 80/tcp
podman port --latest 80`,

View File

@ -16,7 +16,7 @@ var (
Long: renameDescription,
RunE: rename,
Args: cobra.ExactArgs(2),
ValidArgsFunction: common.AutocompletePortCommand,
ValidArgsFunction: common.AutocompleteContainerOneArg,
Example: "podman rename containerA newName",
}