(ns *docker.Namespace, host string, action string, fn func(*docker.Application) error)
| 62 | type NamespaceRunE func(ctx context.Context, ns *docker.Namespace, cmd *cobra.Command, args []string) error |
| 63 | |
| 64 | func 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 | |
| 77 | func WithNamespace(fn NamespaceRunE) func(*cobra.Command, []string) error { |
| 78 | return func(cmd *cobra.Command, args []string) error { |
searching dependent graphs…