summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-05-17 16:48:08 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-05-19 14:04:23 +0200
commit9c9fc96d2756ba6ff1ef3a2e8301992d4b5ab189 (patch)
tree5d71652bcc4db78ac9186cbd0a410a5e39847831
parent337f8b9d98e9eac0d8b826fd7c8d0e94342e0d9f (diff)
downloadpodman-9c9fc96d2756ba6ff1ef3a2e8301992d4b5ab189.tar.gz
podman-9c9fc96d2756ba6ff1ef3a2e8301992d4b5ab189.tar.bz2
podman-9c9fc96d2756ba6ff1ef3a2e8301992d4b5ab189.zip
shell completion: use more constants instead of duplicating strings
It is better to just reuse the existing constants instead of duplicating the strings. [NO NEW TESTS NEEDED] Signed-off-by: Paul Holzinger <pholzing@redhat.com>
-rw-r--r--cmd/podman/common/completion.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd/podman/common/completion.go b/cmd/podman/common/completion.go
index 492e5bc01..58dff3578 100644
--- a/cmd/podman/common/completion.go
+++ b/cmd/podman/common/completion.go
@@ -1208,21 +1208,21 @@ func AutocompleteWaitCondition(cmd *cobra.Command, args []string, toComplete str
// AutocompleteCgroupManager - Autocomplete cgroup manager options.
// -> "cgroupfs", "systemd"
func AutocompleteCgroupManager(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
- types := []string{"cgroupfs", "systemd"}
+ types := []string{config.CgroupfsCgroupsManager, config.SystemdCgroupsManager}
return types, cobra.ShellCompDirectiveNoFileComp
}
// AutocompleteEventBackend - Autocomplete event backend options.
// -> "file", "journald", "none"
func AutocompleteEventBackend(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
- types := []string{"file", "journald", "none"}
+ types := []string{events.LogFile.String(), events.Journald.String(), events.Null.String()}
return types, cobra.ShellCompDirectiveNoFileComp
}
// AutocompleteNetworkBackend - Autocomplete network backend options.
// -> "cni", "netavark"
func AutocompleteNetworkBackend(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
- types := []string{"cni", "netavark"}
+ types := []string{string(types.CNI), string(types.Netavark)}
return types, cobra.ShellCompDirectiveNoFileComp
}
@@ -1235,7 +1235,7 @@ func AutocompleteLogLevel(cmd *cobra.Command, args []string, toComplete string)
// AutocompleteSDNotify - Autocomplete sdnotify options.
// -> "container", "conmon", "ignore"
func AutocompleteSDNotify(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
- types := []string{"container", "conmon", "ignore"}
+ types := []string{define.SdNotifyModeContainer, define.SdNotifyModeContainer, define.SdNotifyModeIgnore}
return types, cobra.ShellCompDirectiveNoFileComp
}