MCPcopy Create free account
hub / github.com/containerd/nerdctl / NamespaceNames

Function NamespaceNames

cmd/nerdctl/completion/completion_unix.go:84–108  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string, toComplete string)

Source from the content-addressed store, hash-verified

82}
83
84func NamespaceNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
85 globalOptions, err := helpers.ProcessRootCmdFlags(cmd)
86 if err != nil {
87 return nil, cobra.ShellCompDirectiveError
88 }
89 if rootlessutil.IsRootlessParent() {
90 _ = rootlessutil.ParentMain(globalOptions.HostGatewayIP)
91 return nil, cobra.ShellCompDirectiveNoFileComp
92 }
93
94 client, ctx, cancel, err := clientutil.NewClient(cmd.Context(), globalOptions.Namespace, globalOptions.Address)
95 if err != nil {
96 return nil, cobra.ShellCompDirectiveError
97 }
98 defer cancel()
99 nsService := client.NamespaceService()
100 nsList, err := nsService.List(ctx)
101 if err != nil {
102 log.L.Warn(err)
103 return nil, cobra.ShellCompDirectiveError
104 }
105 var candidates []string
106 candidates = append(candidates, nsList...)
107 return candidates, cobra.ShellCompDirectiveNoFileComp
108}
109
110func SnapshotterNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
111 globalOptions, err := helpers.ProcessRootCmdFlags(cmd)

Callers

nothing calls this directly

Calls 5

ProcessRootCmdFlagsFunction · 0.92
IsRootlessParentFunction · 0.92
ParentMainFunction · 0.92
NewClientFunction · 0.92
ListMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…