mirror of
https://codeberg.org/shroff/phylum.git
synced 2026-04-28 00:00:50 -05:00
33 lines
639 B
Go
33 lines
639 B
Go
package fs
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
|
|
"github.com/shroff/phylum/server/internal/command/common"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func setupSearchCommand() *cobra.Command {
|
|
cmd := cobra.Command{
|
|
Use: "search",
|
|
Short: "List Trashed Resources",
|
|
Args: cobra.MinimumNArgs(1),
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
f := common.UserFileSystem(cmd)
|
|
query := strings.Join(args, " ")
|
|
res, err := f.Search(query)
|
|
if err != nil {
|
|
fmt.Println("cannot search: " + err.Error())
|
|
os.Exit(1)
|
|
}
|
|
|
|
for _, c := range res {
|
|
fmt.Println(common.FormatResourceSummary(c, "", nil))
|
|
}
|
|
},
|
|
}
|
|
return &cmd
|
|
}
|