MCPcopy
hub / github.com/basecamp/once / withApplication

Function withApplication

internal/command/root.go:64–75  ·  view source on GitHub ↗
(ns *docker.Namespace, host string, action string, fn func(*docker.Application) error)

Source from the content-addressed store, hash-verified

62type NamespaceRunE func(ctx context.Context, ns *docker.Namespace, cmd *cobra.Command, args []string) error
63
64func withApplication(ns *docker.Namespace, host string, action string, fn func(*docker.Application) error) error {
65 app := ns.ApplicationByHost(host)
66 if app == nil {
67 return fmt.Errorf("no application found at host %q", host)
68 }
69
70 if err := fn(app); err != nil {
71 return fmt.Errorf("%s application: %w", action, err)
72 }
73
74 return nil
75}
76
77func WithNamespace(fn NamespaceRunE) func(*cobra.Command, []string) error {
78 return func(cmd *cobra.Command, args []string) error {

Callers 7

runMethod · 0.85
runMethod · 0.85
runMethod · 0.85
runMethod · 0.85
TestWithApplicationFoundFunction · 0.85
TestWithApplicationErrorFunction · 0.85

Calls 1

ApplicationByHostMethod · 0.80

Tested by 3

TestWithApplicationFoundFunction · 0.68
TestWithApplicationErrorFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…