✨ Support list members

This commit is contained in:
chaoqun committed 2024-04-12 23:01:47 +08:00
1 parent b3bd74cee3
commit 5262dea021
4 files changed
+54 -2

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
package member
import (
"github.com/eat-pray-ai/yutu/pkg/yutuber"
"github.com/spf13/cobra"
)
var listCmd = &cobra.Command{
Use: "list",
Short: "list channel's members",
Long: "list channel's members, such as channelId, displayName, etc.",
Run: func(cmd *cobra.Command, args []string) {
m := yutuber.NewMember(
yutuber.WithMemberChannelId(memberChannelId),
)
m.List(parts, output)
},
}
func init() {
memberCmd.AddCommand(listCmd)
listCmd.Flags().StringVarP(&memberChannelId, "memberChannelId", "c", "", "Comma separated channelIDs")
listCmd.Flags().StringSliceVarP(&parts, "parts", "p", []string{"snippet"}, "Comma separated parts")
listCmd.Flags().StringVarP(&output, "output", "o", "", "Output format: json or yaml")
}
+25
View File
@@ -0,0 +1,25 @@
package member
import (
"github.com/eat-pray-ai/yutu/cmd"
"github.com/spf13/cobra"
)
var (
memberChannelId string
parts []string
output string
)
var memberCmd = &cobra.Command{
Use: "member",
Short: "manipulate YouTube members",
Long: "manipulate YouTube members, only list for now",
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
},
}
func init() {
cmd.RootCmd.AddCommand(memberCmd)
}
+2 -2
View File
@@ -8,7 +8,7 @@ import (
var listCmd = &cobra.Command{
Use: "list",
Short: "list video categories",
Long: "list video categories's info, such as ID, title, assignable, etc.",
Long: "list video categories' info, such as ID, title, assignable, etc.",
Run: func(cmd *cobra.Command, args []string) {
vc := yutuber.NewVideoCategory(
yutuber.WithRegionCode(regionCode),
@@ -21,6 +21,6 @@ func init() {
videoCategoryCmd.AddCommand(listCmd)
listCmd.Flags().StringVarP(&regionCode, "regionCode", "r", "US", "region code")
listCmd.Flags().StringSliceVarP(&parts, "part", "p", []string{"id", "snippet"}, "part")
listCmd.Flags().StringSliceVarP(&parts, "parts", "p", []string{"id", "snippet"}, "Comma separated parts")
listCmd.Flags().StringVarP(&output, "output", "o", "", "Output format: json or yaml")
}
+1
View File
@@ -4,6 +4,7 @@ import (
"github.com/eat-pray-ai/yutu/cmd"
_ "github.com/eat-pray-ai/yutu/cmd/activity"
_ "github.com/eat-pray-ai/yutu/cmd/channel"
_ "github.com/eat-pray-ai/yutu/cmd/member"
_ "github.com/eat-pray-ai/yutu/cmd/playlist"
_ "github.com/eat-pray-ai/yutu/cmd/playlistItem"
_ "github.com/eat-pray-ai/yutu/cmd/video"