(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions)
| 36 | } |
| 37 | |
| 38 | func eventsCommand(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions) *cobra.Command { |
| 39 | opts := eventsOpts{ |
| 40 | composeOptions: &composeOptions{ |
| 41 | ProjectOptions: p, |
| 42 | }, |
| 43 | } |
| 44 | cmd := &cobra.Command{ |
| 45 | Use: "events [OPTIONS] [SERVICE...]", |
| 46 | Short: "Receive real time events from containers", |
| 47 | RunE: Adapt(func(ctx context.Context, args []string) error { |
| 48 | return runEvents(ctx, dockerCli, backendOptions, opts, args) |
| 49 | }), |
| 50 | ValidArgsFunction: completeServiceNames(dockerCli, p), |
| 51 | } |
| 52 | |
| 53 | cmd.Flags().BoolVar(&opts.json, "json", false, "Output events as a stream of json objects") |
| 54 | cmd.Flags().StringVar(&opts.since, "since", "", "Show all events created since timestamp") |
| 55 | cmd.Flags().StringVar(&opts.until, "until", "", "Stream events until this timestamp") |
| 56 | return cmd |
| 57 | } |
| 58 | |
| 59 | func runEvents(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, opts eventsOpts, services []string) error { |
| 60 | name, err := opts.toProjectName(ctx, dockerCli) |
no test coverage detected