code: func NewStatsCommand(dockerCli command.Cli) *cobra.Command {
  	var opts statsOptions
  
  	cmd := &cobra.Command{
  		Use:   "stats [OPTIONS] [CONTAINER...]",
  		Short: "Display a live stream of container(s) resource usage statistics",
  		Args:  cli.RequiresMinArgs(0),
  		RunE: func(cmd *cobra.Command, args []string) error {
  			opts.containers = args
  			return runStats(dockerCli, &opts)
  		},
  	}
  
  	flags := cmd.Flags()
  	flags.BoolVarP(&opts.all, "all", "a", false, "Show all containers (default shows just running)")
  	flags.BoolVar(&opts.noStream, "no-stream", false, "Disable streaming stats and only pull the first result")
  	flags.BoolVar(&opts.noTrunc, "no-trunc", false, "Do not truncate output")
  	flags.StringVar(&opts.format, "format", "", "Pretty-print images using a Go template")
  	return cmd
  }
docs: // NewStatsCommand creates a new cobra.Command for `docker stats`