package cmd import ( "fmt" "log" "slices" "github.com/Jaculabilis/intake/core" "github.com/spf13/cobra" ) var sourceListCmd = &cobra.Command{ Use: "list", Aliases: []string{"ls"}, Short: "List sources", Long: `Print the list of sources. `, Run: func(cmd *cobra.Command, args []string) { sourceList() }, } func init() { sourceCmd.AddCommand(sourceListCmd) } func sourceList() { db := openAndMigrateDb() names, err := core.GetSources(db) if err != nil { log.Fatalf("error: %v", err) } slices.Sort(names) for _, name := range names { fmt.Println(name) } }