func statsCommand() *cobra.Command {
	var (
		showDownloadCount bool
		listVersions      bool
		out               string
	)
	cmd := &cobra.Command{
		Use:           "stats --download-count <module1> <module2>",
		Short:         "fetch and calculate stats",
		SilenceErrors: true,
		RunE: func(cmd *cobra.Command, args []string) error {
			modules := []string{"github.com/kataras/iris", "github.com/kataras/iris/v12"}
			if len(args) > 0 {
				modules = args
			}
			if showDownloadCount {
				if err := executeShowDownloadCount(cmd, modules, out); err != nil {
					return err
				}
			}
			if listVersions {
				if err := executeListVersions(cmd, modules, showDownloadCount); err != nil {
					return err
				}
			}
			return nil
		},
	}
	cmd.Flags().StringVar(&out, "out", out, "--out=downloads.yml to export total download counts")
	cmd.Flags().BoolVar(&showDownloadCount, "download-count", showDownloadCount, "--download-count to fetch download count")
	cmd.Flags().BoolVar(&listVersions, "versions", listVersions, "--versions to list versions")
	cmd.AddCommand(statsCompareCommand())
	return cmd
}
stats --download-count [modules]
--versions [modules]

go run -race main.go stats -v --download-count --out=downloads.yml gopkg.in/yaml.v2 gopkg.in/yaml.v3 github.com/kataras/iris github.com/kataras/iris/v12
package cmd
import (
	"errors"
	"fmt"
	"os"
	"sort"
	"strings"
	"sync"
	"time"
	"github.com/kataras/iris-cli/utils"
	"github.com/kataras/golog"
	"github.com/spf13/cobra"
)