You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package root
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/synctv-org/synctv/internal/bootstrap"
|
|
|
|
"github.com/synctv-org/synctv/internal/db"
|
|
|
|
)
|
|
|
|
|
|
|
|
var ShowCmd = &cobra.Command{
|
|
|
|
Use: "show",
|
|
|
|
Short: "show root",
|
|
|
|
Long: `show root`,
|
|
|
|
PreRunE: func(cmd *cobra.Command, args []string) error {
|
|
|
|
return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add(
|
|
|
|
bootstrap.InitStdLog,
|
|
|
|
bootstrap.InitConfig,
|
|
|
|
bootstrap.InitDatabase,
|
|
|
|
).Run()
|
|
|
|
},
|
|
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
|
|
roots := db.GetRoots()
|
|
|
|
for _, root := range roots {
|
|
|
|
fmt.Printf("id: %s\tusername: %s\n", root.ID, root.Username)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
RootCmd.AddCommand(ShowCmd)
|
|
|
|
}
|