Skip to content

Commit d2741ba

Browse files
committed
Rename completion.ShellCompleteX methods to completion.X
Signed-off-by: apostasie <[email protected]>
1 parent a07d906 commit d2741ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+70
-70
lines changed

cmd/nerdctl/apparmor_unload_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ func apparmorUnloadAction(cmd *cobra.Command, args []string) error {
4848
}
4949

5050
func apparmorUnloadShellComplete(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
51-
return completion.ShellCompleteApparmorProfiles(cmd)
51+
return completion.ApparmorProfiles(cmd)
5252
}

cmd/nerdctl/builder_build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ If Dockerfile is not present and -f is not specified, it will look for Container
7373
// #region platform flags
7474
// platform is defined as StringSlice, not StringArray, to allow specifying "--platform=amd64,arm64"
7575
buildCommand.Flags().StringSlice("platform", []string{}, "Set target platform for build (e.g., \"amd64\", \"arm64\")")
76-
buildCommand.RegisterFlagCompletionFunc("platform", completion.ShellCompletePlatforms)
76+
buildCommand.RegisterFlagCompletionFunc("platform", completion.Platforms)
7777
buildCommand.Flags().StringArray("build-context", []string{}, "Additional build contexts (e.g., name=path)")
7878
// #endregion
7979

cmd/nerdctl/completion/completion.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
"github.com/containerd/nerdctl/v2/pkg/netutil"
3434
)
3535

36-
func ShellCompleteImageNames(cmd *cobra.Command) ([]string, cobra.ShellCompDirective) {
36+
func ImageNames(cmd *cobra.Command) ([]string, cobra.ShellCompDirective) {
3737
globalOptions, err := helpers.ProcessRootCmdFlags(cmd)
3838
if err != nil {
3939
return nil, cobra.ShellCompDirectiveError
@@ -56,7 +56,7 @@ func ShellCompleteImageNames(cmd *cobra.Command) ([]string, cobra.ShellCompDirec
5656
return candidates, cobra.ShellCompDirectiveNoFileComp
5757
}
5858

59-
func ShellCompleteContainerNames(cmd *cobra.Command, filterFunc func(containerd.ProcessStatus) bool) ([]string, cobra.ShellCompDirective) {
59+
func ContainerNames(cmd *cobra.Command, filterFunc func(containerd.ProcessStatus) bool) ([]string, cobra.ShellCompDirective) {
6060
globalOptions, err := helpers.ProcessRootCmdFlags(cmd)
6161
if err != nil {
6262
return nil, cobra.ShellCompDirectiveError
@@ -104,8 +104,8 @@ func ShellCompleteContainerNames(cmd *cobra.Command, filterFunc func(containerd.
104104
return candidates, cobra.ShellCompDirectiveNoFileComp
105105
}
106106

107-
// ShellCompleteNetworkNames includes {"bridge","host","none"}
108-
func ShellCompleteNetworkNames(cmd *cobra.Command, exclude []string) ([]string, cobra.ShellCompDirective) {
107+
// NetworkNames includes {"bridge","host","none"}
108+
func NetworkNames(cmd *cobra.Command, exclude []string) ([]string, cobra.ShellCompDirective) {
109109
globalOptions, err := helpers.ProcessRootCmdFlags(cmd)
110110
if err != nil {
111111
return nil, cobra.ShellCompDirectiveError
@@ -137,7 +137,7 @@ func ShellCompleteNetworkNames(cmd *cobra.Command, exclude []string) ([]string,
137137
return candidates, cobra.ShellCompDirectiveNoFileComp
138138
}
139139

140-
func ShellCompleteVolumeNames(cmd *cobra.Command) ([]string, cobra.ShellCompDirective) {
140+
func VolumeNames(cmd *cobra.Command) ([]string, cobra.ShellCompDirective) {
141141
globalOptions, err := helpers.ProcessRootCmdFlags(cmd)
142142
if err != nil {
143143
return nil, cobra.ShellCompDirectiveError
@@ -153,7 +153,7 @@ func ShellCompleteVolumeNames(cmd *cobra.Command) ([]string, cobra.ShellCompDire
153153
return candidates, cobra.ShellCompDirectiveNoFileComp
154154
}
155155

156-
func ShellCompletePlatforms(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
156+
func Platforms(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
157157
candidates := []string{
158158
"amd64",
159159
"arm64",

cmd/nerdctl/completion/completion_freebsd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ package completion
1818

1919
import "github.com/spf13/cobra"
2020

21-
func ShellCompleteCgroupManagerNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
21+
func CgroupManagerNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
2222
return nil, cobra.ShellCompDirectiveNoFileComp
2323
}

cmd/nerdctl/completion/completion_linux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"github.com/containerd/nerdctl/v2/pkg/rootlessutil"
2525
)
2626

27-
func ShellCompleteApparmorProfiles(cmd *cobra.Command) ([]string, cobra.ShellCompDirective) {
27+
func ApparmorProfiles(cmd *cobra.Command) ([]string, cobra.ShellCompDirective) {
2828
profiles, err := apparmorutil.Profiles()
2929
if err != nil {
3030
return nil, cobra.ShellCompDirectiveError
@@ -36,7 +36,7 @@ func ShellCompleteApparmorProfiles(cmd *cobra.Command) ([]string, cobra.ShellCom
3636
return names, cobra.ShellCompDirectiveNoFileComp
3737
}
3838

39-
func ShellCompleteCgroupManagerNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
39+
func CgroupManagerNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
4040
candidates := []string{"cgroupfs"}
4141
if ncdefaults.IsSystemdAvailable() {
4242
candidates = append(candidates, "systemd")

cmd/nerdctl/completion/completion_unix.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ import (
2929
"github.com/containerd/nerdctl/v2/pkg/rootlessutil"
3030
)
3131

32-
func ShellCompleteNetworkDrivers(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
32+
func NetworkDrivers(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
3333
candidates := []string{"bridge", "macvlan", "ipvlan"}
3434
return candidates, cobra.ShellCompDirectiveNoFileComp
3535
}
3636

37-
func ShellCompleteIPAMDrivers(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
37+
func IPAMDrivers(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
3838
return []string{"default", "host-local", "dhcp"}, cobra.ShellCompDirectiveNoFileComp
3939
}
4040

41-
func ShellCompleteNamespaceNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
41+
func NamespaceNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
4242
globalOptions, err := helpers.ProcessRootCmdFlags(cmd)
4343
if err != nil {
4444
return nil, cobra.ShellCompDirectiveError
@@ -64,7 +64,7 @@ func ShellCompleteNamespaceNames(cmd *cobra.Command, args []string, toComplete s
6464
return candidates, cobra.ShellCompDirectiveNoFileComp
6565
}
6666

67-
func ShellCompleteSnapshotterNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
67+
func SnapshotterNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
6868
globalOptions, err := helpers.ProcessRootCmdFlags(cmd)
6969
if err != nil {
7070
return nil, cobra.ShellCompDirectiveError

cmd/nerdctl/completion/completion_windows.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ package completion
1818

1919
import "github.com/spf13/cobra"
2020

21-
func ShellCompleteNamespaceNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
21+
func NamespaceNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
2222
return nil, cobra.ShellCompDirectiveNoFileComp
2323
}
2424

25-
func ShellCompleteSnapshotterNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
25+
func SnapshotterNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
2626
return nil, cobra.ShellCompDirectiveNoFileComp
2727
}
2828

29-
func ShellCompleteCgroupManagerNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
29+
func CgroupManagerNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
3030
return nil, cobra.ShellCompDirectiveNoFileComp
3131
}
3232

33-
func ShellCompleteNetworkDrivers(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
33+
func NetworkDrivers(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
3434
candidates := []string{"nat"}
3535
return candidates, cobra.ShellCompDirectiveNoFileComp
3636
}
3737

38-
func ShellCompleteIPAMDrivers(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
38+
func IPAMDrivers(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
3939
return []string{"default"}, cobra.ShellCompDirectiveNoFileComp
4040
}

cmd/nerdctl/container_attach.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,5 @@ func attachShellComplete(cmd *cobra.Command, args []string, toComplete string) (
9696
statusFilterFn := func(st containerd.ProcessStatus) bool {
9797
return st == containerd.Running
9898
}
99-
return completion.ShellCompleteContainerNames(cmd, statusFilterFn)
99+
return completion.ContainerNames(cmd, statusFilterFn)
100100
}

cmd/nerdctl/container_commit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func commitAction(cmd *cobra.Command, args []string) error {
9494

9595
func commitShellComplete(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
9696
if len(args) == 0 {
97-
return completion.ShellCompleteContainerNames(cmd, nil)
97+
return completion.ContainerNames(cmd, nil)
9898
}
9999
return nil, cobra.ShellCompDirectiveNoFileComp
100100
}

cmd/nerdctl/container_diff.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,5 +227,5 @@ func appendChanges(changes []fs.Change, new fs.Change) []fs.Change {
227227

228228
func diffShellComplete(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
229229
// show container names
230-
return completion.ShellCompleteContainerNames(cmd, nil)
230+
return completion.ContainerNames(cmd, nil)
231231
}

0 commit comments

Comments
 (0)