MCPcopy Create free account
hub / github.com/celer-pkg/celer / Command

Method Command

cmds/cmd_search.go:21–53  ·  view source on GitHub ↗
(celer *configs.Celer)

Source from the content-addressed store, hash-verified

19}
20
21func (s *searchCmd) Command(celer *configs.Celer) *cobra.Command {
22 s.celer = celer
23 command := &cobra.Command{
24 Use: "search",
25 Short: "Search available ports from ports repository.",
26 Long: `Search available ports from ports repository.
27
28This command searches for ports by name and version pattern. It supports
29wildcard matching for flexible searches.
30
31Pattern matching rules:
32 - Exact match: zlib@1.3.1
33 - Prefix match: zlib*
34 - Suffix match: *@1.3.1
35 - Contains match: *lib*
36
37Examples:
38 celer search zlib@1.3.1 # Search for exact match
39 celer search zlib* # Search for all zlib versions
40 celer search *@1.3.1 # Search for all ports with version 1.3.1
41 celer search *ffmpeg* # Search for all ports containing 'ffmpeg'`,
42 Args: cobra.ExactArgs(1),
43 RunE: func(cmd *cobra.Command, args []string) error {
44 return s.doSearch(args[0])
45 },
46 ValidArgsFunction: s.completion,
47 }
48
49 // Silence cobra's error and usage output to avoid duplicate messages.
50 command.SilenceErrors = true
51 command.SilenceUsage = true
52 return command
53}
54
55func (s *searchCmd) doSearch(pattern string) error {
56 // Initialize celer configuration.

Calls 1

doSearchMethod · 0.95