diff --git a/cli/command/completion/functions.go b/cli/command/completion/functions.go index 2272a53ab..c2faaa2b6 100644 --- a/cli/command/completion/functions.go +++ b/cli/command/completion/functions.go @@ -177,6 +177,8 @@ var commonPlatforms = []string{ // - we currently exclude architectures that may have unofficial builds, // but don't have wide adoption (and no support), such as loong64, mipsXXX, // ppc64 (non-le) to prevent confusion. -func Platforms(_ *cobra.Command, _ []string, _ string) (platforms []string, _ cobra.ShellCompDirective) { - return commonPlatforms, cobra.ShellCompDirectiveNoFileComp +func Platforms() cobra.CompletionFunc { + return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return commonPlatforms, cobra.ShellCompDirectiveNoFileComp + } } diff --git a/cli/command/completion/functions_test.go b/cli/command/completion/functions_test.go index 719037467..eef1755ad 100644 --- a/cli/command/completion/functions_test.go +++ b/cli/command/completion/functions_test.go @@ -304,7 +304,7 @@ func TestCompleteNetworkNames(t *testing.T) { } func TestCompletePlatforms(t *testing.T) { - values, directives := Platforms(nil, nil, "") + values, directives := Platforms()(nil, nil, "") assert.Check(t, is.Equal(directives&cobra.ShellCompDirectiveNoFileComp, cobra.ShellCompDirectiveNoFileComp), "Should not perform file completion") assert.Check(t, is.DeepEqual(values, commonPlatforms)) }