MCPcopy Index your code
hub / github.com/docker/cli / newMetadataSubcommand

Function newMetadataSubcommand

cli-plugins/plugin/plugin.go:205–224  ·  view source on GitHub ↗
(plugin *cobra.Command, meta metadata.Metadata)

Source from the content-addressed store, hash-verified

203}
204
205func newMetadataSubcommand(plugin *cobra.Command, meta metadata.Metadata) *cobra.Command {
206 if meta.ShortDescription == "" {
207 meta.ShortDescription = plugin.Short
208 }
209 cmd := &cobra.Command{
210 Use: metadata.MetadataSubcommandName,
211 Hidden: true,
212 // Suppress the global/parent PersistentPreRunE, which
213 // needlessly initializes the client and tries to
214 // connect to the daemon.
215 PersistentPreRun: func(cmd *cobra.Command, args []string) {},
216 RunE: func(cmd *cobra.Command, args []string) error {
217 enc := json.NewEncoder(os.Stdout)
218 enc.SetEscapeHTML(false)
219 enc.SetIndent("", " ")
220 return enc.Encode(meta)
221 },
222 }
223 return cmd
224}
225
226// RunningStandalone tells a CLI plugin it is run standalone by direct execution
227func RunningStandalone() bool {

Callers 1

newPluginCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…