code: func NewSearchCommand(dockerCli command.Cli) *cobra.Command {
  	options := searchOptions{filter: opts.NewFilterOpt()}
  
  	cmd := &cobra.Command{
  		Use:   "search [OPTIONS] TERM",
  		Short: "Search the Docker Hub for images",
  		Args:  cli.ExactArgs(1),
  		RunE: func(cmd *cobra.Command, args []string) error {
  			options.term = args[0]
  			return runSearch(dockerCli, options)
  		},
  	}
  
  	flags := cmd.Flags()
  
  	flags.BoolVar(&options.noTrunc, "no-trunc", false, "Don't truncate output")
  	flags.VarP(&options.filter, "filter", "f", "Filter output based on conditions provided")
  	flags.IntVar(&options.limit, "limit", registry.DefaultSearchLimit, "Max number of search results")
  	flags.StringVar(&options.format, "format", "", "Pretty-print search using a Go template")
  
  	flags.BoolVar(&options.automated, "automated", false, "Only show automated builds")
  	flags.UintVarP(&options.stars, "stars", "s", 0, "Only displays with at least x stars")
  
  	flags.MarkDeprecated("automated", "use --filter=is-automated=true instead")
  	flags.MarkDeprecated("stars", "use --filter=stars=3 instead")
  
  	return cmd
  }
docs: // NewSearchCommand creates a new `docker search` command