velodrome/transform/plugins/count.go
func NewCountPlugin(runner func(Plugin) error) *cobra.Command {
	stateCounter := &StatePlugin{}
	eventCounter := &EventCounterPlugin{}
	commentsAsEvents := NewFakeCommentPluginWrapper(eventCounter)
	commentCounter := &CommentCounterPlugin{}
	authorLoggable := NewMultiplexerPluginWrapper(
		commentsAsEvents,
		commentCounter,
	)
	authorLogged := NewAuthorLoggerPluginWrapper(authorLoggable)
	fullMultiplex := NewMultiplexerPluginWrapper(authorLogged, stateCounter)

	fakeOpen := NewFakeOpenPluginWrapper(fullMultiplex)
	typeFilter := NewTypeFilterWrapperPlugin(fakeOpen)
	authorFilter := NewAuthorFilterPluginWrapper(typeFilter)

	cmd := &cobra.Command{
		Use:   "count",
		Short: "Count events and number of issues in given state, and for how long",
		RunE: func(cmd *cobra.Command, args []string) error {
			if err := eventCounter.CheckFlags(); err != nil {
				return err
			}
			if err := stateCounter.CheckFlags(); err != nil {
				return err
			}
			if err := typeFilter.CheckFlags(); err != nil {
				return err
			}
			if err := commentCounter.CheckFlags(); err != nil {
				return err
			}
			return runner(authorFilter)
		},
	}

	eventCounter.AddFlags(cmd)
	stateCounter.AddFlags(cmd)
	commentCounter.AddFlags(cmd)
	typeFilter.AddFlags(cmd)
	authorFilter.AddFlags(cmd)
	authorLogged.AddFlags(cmd)

	return cmd
}
func NewCountPlugin(runner func(Plugin) error) *cobra.Command {
	stateCounter := &StatePlugin{}
	eventCounter := &EventCounterPlugin{}
	commentsAsEvents := NewFakeCommentPluginWrapper(eventCounter)
	commentCounter := &CommentCounterPlugin{}
	authorLoggable := NewMultiplexerPluginWrapper(
		commentsAsEvents,
		commentCounter,
	)
	authorLogged := NewAuthorLoggerPluginWrapper(authorLoggable)
	fullMultiplex := NewMultiplexerPluginWrapper(authorLogged, stateCounter)

	fakeOpen := NewFakeOpenPluginWrapper(fullMultiplex)
	typeFilter := NewTypeFilterWrapperPlugin(fakeOpen)
	authorFilter := NewAuthorFilterPluginWrapper(typeFilter)

	cmd := &cobra.Command{
		Use:   "count",
		Short: "Count events and number of issues in given state, and for how long",
		RunE: func(cmd *cobra.Command, args []string) error {
			if err := eventCounter.CheckFlags(); err != nil {
				return err
			}
			if err := stateCounter.CheckFlags(); err != nil {
				return err
			}
			if err := typeFilter.CheckFlags(); err != nil {
				return err
			}
			if err := commentCounter.CheckFlags(); err != nil {
				return err
			}
			return runner(authorFilter)
		},
	}

	eventCounter.AddFlags(cmd)
	stateCounter.AddFlags(cmd)
	commentCounter.AddFlags(cmd)
	typeFilter.AddFlags(cmd)
	authorFilter.AddFlags(cmd)
	authorLogged.AddFlags(cmd)

	return cmd
}
// NewCountPlugin counts events and number of issues in given state, and for how long.