✨ Add jsonpath flag
This commit is contained in:
1 parent
dacc3219f4
commit
f859570b04
85 files changed
+319
-217
No files matched your search
@@ -29,6 +29,7 @@ var (
|
||||
regionCode string
|
||||
parts []string
|
||||
output string
|
||||
jpath string
|
||||
)
|
||||
|
||||
var activityCmd = &cobra.Command{
|
||||
|
||||
@@ -53,6 +53,10 @@ var listTool = mcp.NewTool(
|
||||
"output", mcp.DefaultString("table"),
|
||||
mcp.Description(cmd.TableUsage), mcp.Required(),
|
||||
),
|
||||
mcp.WithString(
|
||||
"jsonpath", mcp.DefaultString(""),
|
||||
mcp.Description(cmd.JpUsage), mcp.Required(),
|
||||
),
|
||||
)
|
||||
|
||||
func run(writer io.Writer) error {
|
||||
@@ -67,7 +71,7 @@ func run(writer io.Writer) error {
|
||||
activity.WithService(nil),
|
||||
)
|
||||
|
||||
return a.List(parts, output, writer)
|
||||
return a.List(parts, output, jpath, writer)
|
||||
}
|
||||
|
||||
var listCmd = &cobra.Command{
|
||||
@@ -99,6 +103,7 @@ func init() {
|
||||
listCmd.Flags().StringVarP(®ionCode, "regionCode", "r", "", rcUsage)
|
||||
listCmd.Flags().StringSliceVarP(&parts, "parts", "p", defaultParts, partsUsage)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
}
|
||||
|
||||
func listHandler(ctx context.Context, request mcp.CallToolRequest) (
|
||||
@@ -124,6 +129,7 @@ func listHandler(ctx context.Context, request mcp.CallToolRequest) (
|
||||
parts[i] = part.(string)
|
||||
}
|
||||
output, _ = args["output"].(string)
|
||||
jpath, _ = args["jsonpath"].(string)
|
||||
|
||||
var writer bytes.Buffer
|
||||
err := run(&writer)
|
||||
|
||||
@@ -42,9 +42,10 @@ var (
|
||||
onBehalfOfContentOwner string
|
||||
videoId string
|
||||
parts []string
|
||||
output string
|
||||
tfmt string
|
||||
tlang string
|
||||
output string
|
||||
jpath string
|
||||
)
|
||||
|
||||
var captionCmd = &cobra.Command{
|
||||
|
||||
@@ -33,7 +33,7 @@ var insertCmd = &cobra.Command{
|
||||
caption.WithService(nil),
|
||||
)
|
||||
|
||||
err := c.Insert(output, cmd.OutOrStdout())
|
||||
err := c.Insert(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -68,6 +68,7 @@ func init() {
|
||||
&onBehalfOfContentOwner, "onBehalfOfContentOwner", "B", "", "",
|
||||
)
|
||||
insertCmd.Flags().StringVarP(&output, "output", "o", "", cmd.SilentUsage)
|
||||
insertCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = insertCmd.MarkFlagRequired("file")
|
||||
_ = insertCmd.MarkFlagRequired("videoId")
|
||||
|
||||
+2
-1
@@ -25,7 +25,7 @@ var listCmd = &cobra.Command{
|
||||
caption.WithService(nil),
|
||||
)
|
||||
|
||||
err := c.List(parts, output, cmd.OutOrStdout())
|
||||
err := c.List(parts, output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -46,4 +46,5 @@ func init() {
|
||||
&parts, "parts", "p", []string{"id", "snippet"}, partsUsage,
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
}
|
||||
@@ -33,7 +33,7 @@ var updateCmd = &cobra.Command{
|
||||
caption.WithService(nil),
|
||||
)
|
||||
|
||||
err := c.Update(output, cmd.OutOrStdout())
|
||||
err := c.Update(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -68,6 +68,7 @@ func init() {
|
||||
&onBehalfOfContentOwner, "onBehalfOfContentOwner", "B", "", "",
|
||||
)
|
||||
updateCmd.Flags().StringVarP(&output, "output", "o", "", cmd.SilentUsage)
|
||||
updateCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = updateCmd.MarkFlagRequired("videoId")
|
||||
}
|
||||
@@ -42,8 +42,9 @@ var (
|
||||
defaultLanguage string
|
||||
description string
|
||||
title string
|
||||
output string
|
||||
parts []string
|
||||
output string
|
||||
jpath string
|
||||
|
||||
onBehalfOfContentOwner string
|
||||
)
|
||||
|
||||
+3
-2
@@ -31,7 +31,7 @@ var listCmd = &cobra.Command{
|
||||
channel.WithService(nil),
|
||||
)
|
||||
|
||||
err := c.List(parts, output, cmd.OutOrStdout())
|
||||
err := c.List(parts, output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -66,8 +66,9 @@ func init() {
|
||||
listCmd.Flags().StringVarP(
|
||||
&onBehalfOfContentOwner, "onBehalfOfContentOwner", "b", "", "",
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringSliceVarP(
|
||||
&parts, "parts", "p", []string{"id", "snippet", "status"}, partsUsage,
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
}
|
||||
@@ -27,7 +27,7 @@ var updateCmd = &cobra.Command{
|
||||
channel.WithService(nil),
|
||||
)
|
||||
|
||||
err := c.Update(output, cmd.OutOrStdout())
|
||||
err := c.Update(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -49,6 +49,7 @@ func init() {
|
||||
)
|
||||
updateCmd.Flags().StringVarP(&title, "title", "t", "", titleUsage)
|
||||
updateCmd.Flags().StringVarP(&output, "output", "o", "", cmd.SilentUsage)
|
||||
updateCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = updateCmd.MarkFlagRequired("id")
|
||||
}
|
||||
@@ -16,6 +16,7 @@ var (
|
||||
channelId string
|
||||
file string
|
||||
output string
|
||||
jpath string
|
||||
|
||||
onBehalfOfContentOwner string
|
||||
onBehalfOfContentOwnerChannel string
|
||||
|
||||
@@ -19,7 +19,7 @@ var insertCmd = &cobra.Command{
|
||||
channelBanner.WithService(nil),
|
||||
)
|
||||
|
||||
err := cb.Insert(output, cmd.OutOrStdout())
|
||||
err := cb.Insert(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -39,6 +39,7 @@ func init() {
|
||||
&onBehalfOfContentOwnerChannel, "onBehalfOfContentOwnerChannel", "B", "", "",
|
||||
)
|
||||
insertCmd.Flags().StringVarP(&output, "output", "o", "", cmd.SilentUsage)
|
||||
insertCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = insertCmd.MarkFlagRequired("channelId")
|
||||
_ = insertCmd.MarkFlagRequired("file")
|
||||
|
||||
@@ -23,6 +23,7 @@ var (
|
||||
onBehalfOfContentOwner string
|
||||
parts []string
|
||||
output string
|
||||
jpath string
|
||||
)
|
||||
|
||||
var channelSectionCmd = &cobra.Command{
|
||||
|
||||
@@ -26,7 +26,7 @@ var listCmd = &cobra.Command{
|
||||
channelSection.WithService(nil),
|
||||
)
|
||||
|
||||
err := cs.List(parts, output, cmd.OutOrStdout())
|
||||
err := cs.List(parts, output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -48,4 +48,5 @@ func init() {
|
||||
&parts, "parts", "p", []string{"id", "snippet"}, partsUsage,
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
}
|
||||
@@ -38,6 +38,7 @@ var (
|
||||
viewerRating string
|
||||
parts []string
|
||||
output string
|
||||
jpath string
|
||||
)
|
||||
|
||||
var commentCmd = &cobra.Command{
|
||||
|
||||
@@ -27,7 +27,7 @@ var insertCmd = &cobra.Command{
|
||||
comment.WithService(nil),
|
||||
)
|
||||
|
||||
err := c.Insert(output, cmd.OutOrStdout())
|
||||
err := c.Insert(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -53,6 +53,7 @@ func init() {
|
||||
)
|
||||
insertCmd.Flags().StringVarP(&videoId, "videoId", "v", "", vidUsage)
|
||||
insertCmd.Flags().StringVarP(&output, "output", "o", "", cmd.SilentUsage)
|
||||
insertCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = insertCmd.MarkFlagRequired("authorChannelId")
|
||||
_ = insertCmd.MarkFlagRequired("channelId")
|
||||
|
||||
+2
-1
@@ -25,7 +25,7 @@ var listCmd = &cobra.Command{
|
||||
comment.WithService(nil),
|
||||
)
|
||||
|
||||
err := c.List(parts, output, cmd.OutOrStdout())
|
||||
err := c.List(parts, output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -48,4 +48,5 @@ func init() {
|
||||
&parts, "parts", "p", []string{"id", "snippet"}, partsUsage,
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
}
|
||||
@@ -21,7 +21,7 @@ var markAsSpamCmd = &cobra.Command{
|
||||
comment.WithService(nil),
|
||||
)
|
||||
|
||||
err := c.MarkAsSpam(output, cmd.OutOrStdout())
|
||||
err := c.MarkAsSpam(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -34,6 +34,7 @@ func init() {
|
||||
|
||||
markAsSpamCmd.Flags().StringSliceVarP(&ids, "ids", "i", []string{}, idsUsage)
|
||||
markAsSpamCmd.Flags().StringVarP(&output, "output", "o", "", cmd.SilentUsage)
|
||||
markAsSpamCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = markAsSpamCmd.MarkFlagRequired("ids")
|
||||
}
|
||||
@@ -22,7 +22,7 @@ var setModerationStatusCmd = &cobra.Command{
|
||||
comment.WithBanAuthor(banAuthor),
|
||||
)
|
||||
|
||||
err := c.SetModerationStatus(output, cmd.OutOrStdout())
|
||||
err := c.SetModerationStatus(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -45,6 +45,9 @@ func init() {
|
||||
setModerationStatusCmd.Flags().StringVarP(
|
||||
&output, "output", "o", "", cmd.SilentUsage,
|
||||
)
|
||||
setModerationStatusCmd.Flags().StringVarP(
|
||||
&jpath, "jsonpath", "j", "", cmd.JpUsage,
|
||||
)
|
||||
|
||||
_ = setModerationStatusCmd.MarkFlagRequired("ids")
|
||||
_ = setModerationStatusCmd.MarkFlagRequired("moderationStatus")
|
||||
|
||||
@@ -25,7 +25,7 @@ var updateCmd = &cobra.Command{
|
||||
comment.WithService(nil),
|
||||
)
|
||||
|
||||
err := c.Update(output, cmd.OutOrStdout())
|
||||
err := c.Update(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -45,6 +45,7 @@ func init() {
|
||||
&viewerRating, "viewerRating", "r", "", vrUsage,
|
||||
)
|
||||
updateCmd.Flags().StringVarP(&output, "output", "o", "", cmd.SilentUsage)
|
||||
updateCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = updateCmd.MarkFlagRequired("id")
|
||||
}
|
||||
@@ -35,6 +35,7 @@ var (
|
||||
videoId string
|
||||
parts []string
|
||||
output string
|
||||
jpath string
|
||||
)
|
||||
|
||||
var commentThreadCmd = &cobra.Command{
|
||||
|
||||
@@ -25,7 +25,7 @@ var insertCmd = &cobra.Command{
|
||||
commentThread.WithService(nil),
|
||||
)
|
||||
|
||||
err := ct.Insert(output, cmd.OutOrStdout())
|
||||
err := ct.Insert(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -42,6 +42,7 @@ func init() {
|
||||
insertCmd.Flags().StringVarP(&textOriginal, "textOriginal", "t", "", toUsage)
|
||||
insertCmd.Flags().StringVarP(&videoId, "videoId", "v", "", insertVidUsage)
|
||||
insertCmd.Flags().StringVarP(&output, "output", "o", "", cmd.SilentUsage)
|
||||
insertCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = insertCmd.MarkFlagRequired("authorChannelId")
|
||||
_ = insertCmd.MarkFlagRequired("channelId")
|
||||
|
||||
@@ -30,7 +30,7 @@ var listCmd = &cobra.Command{
|
||||
commentThread.WithService(nil),
|
||||
)
|
||||
|
||||
err := ct.List(parts, output, cmd.OutOrStdout())
|
||||
err := ct.List(parts, output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -59,4 +59,5 @@ func init() {
|
||||
&parts, "parts", "p", []string{"id", "snippet"}, partsUsage,
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
}
|
||||
@@ -3,4 +3,5 @@ package cmd
|
||||
const (
|
||||
TableUsage = "json, yaml, or table"
|
||||
SilentUsage = "json, yaml, or silent"
|
||||
JpUsage = "JSONPath expression to filter the output"
|
||||
)
|
||||
@@ -16,6 +16,7 @@ var (
|
||||
hl string
|
||||
parts []string
|
||||
output string
|
||||
jpath string
|
||||
)
|
||||
|
||||
var i18nLanguageCmd = &cobra.Command{
|
||||
|
||||
@@ -15,7 +15,7 @@ var listCmd = &cobra.Command{
|
||||
i18nLanguage.WithHl(hl), i18nLanguage.WithService(nil),
|
||||
)
|
||||
|
||||
err := i.List(parts, output, cmd.OutOrStdout())
|
||||
err := i.List(parts, output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -30,4 +30,5 @@ func init() {
|
||||
&parts, "parts", "p", []string{"id", "snippet"}, partsUsage,
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
}
|
||||
@@ -16,6 +16,7 @@ var (
|
||||
hl string
|
||||
parts []string
|
||||
output string
|
||||
jpath string
|
||||
)
|
||||
|
||||
var i18nRegionCmd = &cobra.Command{
|
||||
|
||||
@@ -15,7 +15,7 @@ var listCmd = &cobra.Command{
|
||||
i18nRegion.WithHl(hl), i18nRegion.WithService(nil),
|
||||
)
|
||||
|
||||
err := i.List(parts, output, cmd.OutOrStdout())
|
||||
err := i.List(parts, output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -30,4 +30,5 @@ func init() {
|
||||
&parts, "parts", "p", []string{"id", "snippet"}, partsUsage,
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
}
|
||||
+2
-1
@@ -19,7 +19,7 @@ var listCmd = &cobra.Command{
|
||||
member.WithService(nil),
|
||||
)
|
||||
|
||||
err := m.List(parts, output, cmd.OutOrStdout())
|
||||
err := m.List(parts, output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -42,4 +42,5 @@ func init() {
|
||||
&parts, "parts", "p", []string{"snippet"}, partsUsage,
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
}
|
||||
@@ -22,6 +22,7 @@ var (
|
||||
mode string
|
||||
parts []string
|
||||
output string
|
||||
jpath string
|
||||
)
|
||||
|
||||
var memberCmd = &cobra.Command{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package membershipsLevel
|
||||
|
||||
import (
|
||||
"github.com/eat-pray-ai/yutu/cmd"
|
||||
"github.com/eat-pray-ai/yutu/pkg/membershipsLevel"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
@@ -12,7 +13,7 @@ var listCmd = &cobra.Command{
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
m := membershipsLevel.NewMembershipsLevel(membershipsLevel.WithService(nil))
|
||||
|
||||
err := m.List(parts, output, cmd.OutOrStdout())
|
||||
err := m.List(parts, output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -27,4 +28,5 @@ func init() {
|
||||
&parts, "parts", "p", []string{"id, snippet"}, partsUsage,
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", outputUsage)
|
||||
listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
}
|
||||
@@ -15,6 +15,7 @@ const (
|
||||
var (
|
||||
parts []string
|
||||
output string
|
||||
jpath string
|
||||
)
|
||||
|
||||
var membershipsLevelCmd = &cobra.Command{
|
||||
|
||||
@@ -27,7 +27,7 @@ var insertCmd = &cobra.Command{
|
||||
playlist.WithService(nil),
|
||||
)
|
||||
|
||||
err := p.Insert(output, cmd.OutOrStdout())
|
||||
err := p.Insert(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -45,6 +45,7 @@ func init() {
|
||||
insertCmd.Flags().StringVarP(&channelId, "channelId", "c", "", insertCidUsage)
|
||||
insertCmd.Flags().StringVarP(&privacy, "privacy", "p", "", privacyUsage)
|
||||
insertCmd.Flags().StringVarP(&output, "output", "o", "", cmd.SilentUsage)
|
||||
insertCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = insertCmd.MarkFlagRequired("title")
|
||||
_ = insertCmd.MarkFlagRequired("channel")
|
||||
|
||||
@@ -29,7 +29,7 @@ var listCmd = &cobra.Command{
|
||||
playlist.WithService(nil),
|
||||
)
|
||||
|
||||
err := p.List(parts, output, cmd.OutOrStdout())
|
||||
err := p.List(parts, output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -55,4 +55,5 @@ func init() {
|
||||
&parts, "parts", "p", []string{"id", "snippet", "status"}, partsUsage,
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", cmd.JpUsage)
|
||||
}
|
||||
@@ -32,8 +32,9 @@ var (
|
||||
language string
|
||||
channelId string
|
||||
privacy string
|
||||
output string
|
||||
parts []string
|
||||
output string
|
||||
jpath string
|
||||
|
||||
onBehalfOfContentOwner string
|
||||
onBehalfOfContentOwnerChannel string
|
||||
|
||||
@@ -27,7 +27,7 @@ var updateCmd = &cobra.Command{
|
||||
playlist.WithService(nil),
|
||||
)
|
||||
|
||||
err := p.Update(output, cmd.OutOrStdout())
|
||||
err := p.Update(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -45,6 +45,7 @@ func init() {
|
||||
updateCmd.Flags().StringVarP(&language, "language", "l", "", languageUsage)
|
||||
updateCmd.Flags().StringVarP(&privacy, "privacy", "p", "", privacyUsage)
|
||||
updateCmd.Flags().StringVarP(&output, "output", "o", "", cmd.SilentUsage)
|
||||
updateCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = updateCmd.MarkFlagRequired("id")
|
||||
}
|
||||
@@ -25,7 +25,7 @@ var insertCmd = &cobra.Command{
|
||||
playlistImage.WithService(nil),
|
||||
)
|
||||
|
||||
err := pi.Insert(output, cmd.OutOrStdout())
|
||||
err := pi.Insert(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -42,6 +42,7 @@ func init() {
|
||||
insertCmd.Flags().Int64VarP(&height, "height", "H", 0, heightUsage)
|
||||
insertCmd.Flags().Int64VarP(&width, "width", "W", 0, widthUsage)
|
||||
insertCmd.Flags().StringVarP(&output, "output", "o", "", cmd.SilentUsage)
|
||||
insertCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = insertCmd.MarkFlagRequired("file")
|
||||
_ = insertCmd.MarkFlagRequired("playlistId")
|
||||
|
||||
@@ -24,7 +24,7 @@ var listCmd = &cobra.Command{
|
||||
playlistImage.WithService(nil),
|
||||
)
|
||||
|
||||
err := pi.List(parts, output, cmd.OutOrStdout())
|
||||
err := pi.List(parts, output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -41,6 +41,7 @@ func init() {
|
||||
&parts, "parts", "p", []string{"id", "kind", "snippet"}, partsUsage,
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", cmd.JpUsage)
|
||||
listCmd.Flags().StringVarP(
|
||||
&onBehalfOfContentOwner, "onBehalfOfContentOwner", "b", "", "",
|
||||
)
|
||||
|
||||
@@ -30,6 +30,7 @@ var (
|
||||
maxResults int64
|
||||
parts []string
|
||||
output string
|
||||
jpath string
|
||||
|
||||
onBehalfOfContentOwner string
|
||||
onBehalfOfContentOwnerChannel string
|
||||
|
||||
@@ -24,7 +24,7 @@ var updateCmd = &cobra.Command{
|
||||
playlistImage.WithService(nil),
|
||||
)
|
||||
|
||||
err := pi.Update(output, cmd.OutOrStdout())
|
||||
err := pi.Update(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -40,6 +40,7 @@ func init() {
|
||||
updateCmd.Flags().Int64VarP(&height, "height", "H", 0, heightUsage)
|
||||
updateCmd.Flags().Int64VarP(&width, "width", "W", 0, widthUsage)
|
||||
updateCmd.Flags().StringVarP(&output, "output", "o", "", cmd.SilentUsage)
|
||||
updateCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = updateCmd.MarkFlagRequired("playlistId")
|
||||
}
|
||||
@@ -31,7 +31,7 @@ var insertCmd = &cobra.Command{
|
||||
playlistItem.WithService(nil),
|
||||
)
|
||||
|
||||
err := pi.Insert(output, cmd.OutOrStdout())
|
||||
err := pi.Insert(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -57,6 +57,7 @@ func init() {
|
||||
&onBehalfOfContentOwner, "onBehalfOfContentOwner", "b", "", "",
|
||||
)
|
||||
insertCmd.Flags().StringVarP(&output, "output", "o", "", cmd.SilentUsage)
|
||||
insertCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = insertCmd.MarkFlagRequired("kind")
|
||||
_ = insertCmd.MarkFlagRequired("playlistId")
|
||||
|
||||
@@ -27,7 +27,7 @@ var listCmd = &cobra.Command{
|
||||
playlistItem.WithService(nil),
|
||||
)
|
||||
|
||||
err := pi.List(parts, output, cmd.OutOrStdout())
|
||||
err := pi.List(parts, output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -45,8 +45,9 @@ func init() {
|
||||
listCmd.Flags().StringVarP(
|
||||
&onBehalfOfContentOwner, "onBehalfOfContentOwner", "b", "", "",
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringSliceVarP(
|
||||
&parts, "parts", "p", []string{"id", "snippet", "status"}, partsUsage,
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
}
|
||||
@@ -34,8 +34,9 @@ var (
|
||||
channelId string
|
||||
maxResults int64
|
||||
privacy string
|
||||
output string
|
||||
parts []string
|
||||
output string
|
||||
jpath string
|
||||
|
||||
onBehalfOfContentOwner string
|
||||
)
|
||||
|
||||
@@ -26,7 +26,7 @@ var updateCmd = &cobra.Command{
|
||||
playlistItem.WithService(nil),
|
||||
)
|
||||
|
||||
err := pi.Update(output, cmd.OutOrStdout())
|
||||
err := pi.Update(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -45,6 +45,7 @@ func init() {
|
||||
&onBehalfOfContentOwner, "onBehalfOfContentOwner", "b", "", "",
|
||||
)
|
||||
updateCmd.Flags().StringVarP(&output, "output", "o", "", cmd.SilentUsage)
|
||||
updateCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = updateCmd.MarkFlagRequired("id")
|
||||
}
|
||||
+2
-1
@@ -44,7 +44,7 @@ var listCmd = &cobra.Command{
|
||||
search.WithService(nil),
|
||||
)
|
||||
|
||||
err := s.List(parts, output, cmd.OutOrStdout())
|
||||
err := s.List(parts, output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -96,4 +96,5 @@ func init() {
|
||||
&parts, "parts", []string{"id", "snippet"}, partsUsage,
|
||||
)
|
||||
listCmd.Flags().StringVar(&output, "output", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringVar(&jpath, "jsonpath", "", cmd.JpUsage)
|
||||
}
|
||||
@@ -72,6 +72,7 @@ var (
|
||||
videoType string
|
||||
parts []string
|
||||
output string
|
||||
jpath string
|
||||
)
|
||||
|
||||
var searchCmd = &cobra.Command{
|
||||
|
||||
@@ -25,7 +25,7 @@ var insertCmd = &cobra.Command{
|
||||
subscription.WithService(nil),
|
||||
)
|
||||
|
||||
err := s.Insert(output, cmd.OutOrStdout())
|
||||
err := s.Insert(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -43,6 +43,7 @@ func init() {
|
||||
insertCmd.Flags().StringVarP(&channelId, "channelId", "c", "", insertCidUsage)
|
||||
insertCmd.Flags().StringVarP(&title, "title", "t", "", titleUsage)
|
||||
insertCmd.Flags().StringVarP(&output, "output", "o", "", cmd.SilentUsage)
|
||||
insertCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = insertCmd.MarkFlagRequired("subscriberChannelId")
|
||||
_ = insertCmd.MarkFlagRequired("channelId")
|
||||
|
||||
@@ -32,7 +32,7 @@ var listCmd = &cobra.Command{
|
||||
subscription.WithService(nil),
|
||||
)
|
||||
|
||||
err := s.List(parts, output, cmd.OutOrStdout())
|
||||
err := s.List(parts, output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -59,8 +59,9 @@ func init() {
|
||||
&onBehalfOfContentOwnerChannel, "onBehalfOfContentOwnerChannel", "B", "", "",
|
||||
)
|
||||
listCmd.Flags().StringVarP(&order, "order", "O", "relevance", orderUsage)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringSliceVarP(
|
||||
&parts, "parts", "p", []string{"id", "snippet"}, partsUsage,
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
}
|
||||
@@ -37,6 +37,7 @@ var (
|
||||
title string
|
||||
parts []string
|
||||
output string
|
||||
jpath string
|
||||
)
|
||||
|
||||
var subscriptionCmd = &cobra.Command{
|
||||
|
||||
@@ -17,7 +17,7 @@ var listCmd = &cobra.Command{
|
||||
superChatEvent.WithService(nil),
|
||||
)
|
||||
|
||||
err := sc.List(parts, output, cmd.OutOrStdout())
|
||||
err := sc.List(parts, output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -34,4 +34,5 @@ func init() {
|
||||
&parts, "parts", "p", []string{"id", "snippet"}, partsUsage,
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
}
|
||||
@@ -18,6 +18,7 @@ var (
|
||||
maxResults int64
|
||||
parts []string
|
||||
output string
|
||||
jpath string
|
||||
)
|
||||
|
||||
var superChatEventCmd = &cobra.Command{
|
||||
|
||||
@@ -17,7 +17,7 @@ var setCmd = &cobra.Command{
|
||||
thumbnail.WithService(nil),
|
||||
)
|
||||
|
||||
err := t.Set(output, cmd.OutOrStdout())
|
||||
err := t.Set(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -31,6 +31,7 @@ func init() {
|
||||
setCmd.Flags().StringVarP(&file, "file", "f", "", fileUsage)
|
||||
setCmd.Flags().StringVarP(&videoId, "videoId", "v", "", vidUsage)
|
||||
setCmd.Flags().StringVarP(&output, "output", "o", "", cmd.SilentUsage)
|
||||
setCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = setCmd.MarkFlagRequired("file")
|
||||
_ = setCmd.MarkFlagRequired("videoId")
|
||||
|
||||
@@ -16,6 +16,7 @@ var (
|
||||
file string
|
||||
videoId string
|
||||
output string
|
||||
jpath string
|
||||
)
|
||||
|
||||
var thumbnailCmd = &cobra.Command{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package video
|
||||
|
||||
import (
|
||||
"github.com/eat-pray-ai/yutu/cmd"
|
||||
"github.com/eat-pray-ai/yutu/pkg/video"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
@@ -23,7 +24,7 @@ var getRatingCmd = &cobra.Command{
|
||||
video.WithService(nil),
|
||||
)
|
||||
|
||||
err := v.GetRating(output, cmd.OutOrStdout())
|
||||
err := v.GetRating(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -39,6 +40,7 @@ func init() {
|
||||
&onBehalfOfContentOwner, "onBehalfOfContentOwner", "b", "", "",
|
||||
)
|
||||
getRatingCmd.Flags().StringVarP(&output, "output", "o", "", grOutputUsage)
|
||||
getRatingCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = getRatingCmd.MarkFlagRequired("ids")
|
||||
}
|
||||
+2
-1
@@ -41,7 +41,7 @@ var insertCmd = &cobra.Command{
|
||||
video.WithService(nil),
|
||||
)
|
||||
|
||||
err := v.Insert(output, cmd.OutOrStdout())
|
||||
err := v.Insert(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -85,6 +85,7 @@ func init() {
|
||||
&onBehalfOfContentOwnerChannel, "onBehalfOfContentOwnerChannel", "B", "", "",
|
||||
)
|
||||
insertCmd.Flags().StringVarP(&output, "output", "o", "", cmd.SilentUsage)
|
||||
insertCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = insertCmd.MarkFlagRequired("file")
|
||||
_ = insertCmd.MarkFlagRequired("categoryId")
|
||||
|
||||
+3
-2
@@ -33,7 +33,7 @@ var listCmd = &cobra.Command{
|
||||
video.WithService(nil),
|
||||
)
|
||||
|
||||
err := v.List(parts, output, cmd.OutOrStdout())
|
||||
err := v.List(parts, output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -57,8 +57,9 @@ func init() {
|
||||
&onBehalfOfContentOwner, "onBehalfOfContentOwner", "b", "", "",
|
||||
)
|
||||
listCmd.Flags().StringVarP(&rating, "myRating", "R", "", listMrUsage)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringSliceVarP(
|
||||
&parts, "parts", "p", []string{"id", "snippet", "status"}, partsUsage,
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
}
|
||||
+2
-1
@@ -33,7 +33,7 @@ var updateCmd = &cobra.Command{
|
||||
video.WithService(nil),
|
||||
)
|
||||
|
||||
err := v.Update(output, cmd.OutOrStdout())
|
||||
err := v.Update(output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -58,6 +58,7 @@ func init() {
|
||||
embeddable, "embeddable", "E", true, embeddableUsage,
|
||||
)
|
||||
updateCmd.Flags().StringVarP(&output, "output", "o", "", cmd.SilentUsage)
|
||||
updateCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", cmd.JpUsage)
|
||||
|
||||
_ = updateCmd.MarkFlagRequired("ids")
|
||||
}
|
||||
+3
-2
@@ -62,8 +62,6 @@ var (
|
||||
privacy string
|
||||
forKids = utils.BoolPtr("false")
|
||||
embeddable = utils.BoolPtr("false")
|
||||
output string
|
||||
parts []string
|
||||
publishAt string
|
||||
regionCode string
|
||||
reasonId string
|
||||
@@ -72,6 +70,9 @@ var (
|
||||
maxHeight int64
|
||||
maxWidth int64
|
||||
maxResults int64
|
||||
parts []string
|
||||
output string
|
||||
jpath string
|
||||
|
||||
notifySubscribers = utils.BoolPtr("false")
|
||||
publicStatsViewable = utils.BoolPtr("false")
|
||||
|
||||
@@ -16,7 +16,7 @@ var listCmd = &cobra.Command{
|
||||
videoAbuseReportReason.WithService(nil),
|
||||
)
|
||||
|
||||
err := va.List(parts, output, cmd.OutOrStdout())
|
||||
err := va.List(parts, output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -32,4 +32,5 @@ func init() {
|
||||
&parts, "parts", "p", []string{"id", "snippet"}, partsUsage,
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
}
|
||||
@@ -16,6 +16,7 @@ var (
|
||||
hl string
|
||||
parts []string
|
||||
output string
|
||||
jpath string
|
||||
)
|
||||
|
||||
var videoAbuseReportReasonCmd = &cobra.Command{
|
||||
|
||||
@@ -18,7 +18,7 @@ var listCmd = &cobra.Command{
|
||||
videoCategory.WithService(nil),
|
||||
)
|
||||
|
||||
err := vc.List(parts, output, cmd.OutOrStdout())
|
||||
err := vc.List(parts, output, jpath, cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
@@ -36,4 +36,5 @@ func init() {
|
||||
&parts, "parts", "p", []string{"id", "snippet"}, partsUsage,
|
||||
)
|
||||
listCmd.Flags().StringVarP(&output, "output", "o", "table", cmd.TableUsage)
|
||||
listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", cmd.JpUsage)
|
||||
}
|
||||
@@ -20,6 +20,7 @@ var (
|
||||
regionCode string
|
||||
parts []string
|
||||
output string
|
||||
jpath string
|
||||
)
|
||||
|
||||
var videoCategoryCmd = &cobra.Command{
|
||||
|
||||
@@ -26,7 +26,7 @@ var setCmd = &cobra.Command{
|
||||
watermark.WithService(nil),
|
||||
)
|
||||
|
||||
err := w.Set(cmd.OutOrStdout())
|
||||
err := w.Set("", cmd.OutOrStdout())
|
||||
if err != nil {
|
||||
_ = cmd.Help()
|
||||
cmd.PrintErrf("Error: %v\n", err)
|
||||
|
||||
@@ -25,7 +25,7 @@ type activity struct {
|
||||
}
|
||||
|
||||
type Activity interface {
|
||||
List([]string, string, io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
Get([]string) ([]*youtube.Activity, error)
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ func (a *activity) Get(parts []string) ([]*youtube.Activity, error) {
|
||||
}
|
||||
|
||||
func (a *activity) List(
|
||||
parts []string, output string, writer io.Writer,
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
activities, err := a.Get(parts)
|
||||
if err != nil {
|
||||
@@ -90,9 +90,9 @@ func (a *activity) List(
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(activities, writer)
|
||||
utils.PrintJSON(activities, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(activities, writer)
|
||||
utils.PrintYAML(activities, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
defer tb.Render()
|
||||
|
||||
+14
-12
@@ -41,9 +41,9 @@ type caption struct {
|
||||
|
||||
type Caption interface {
|
||||
Get(parts []string) ([]*youtube.Caption, error) // todo: return error
|
||||
List(parts []string, output string, writer io.Writer) error
|
||||
Insert(output string, writer io.Writer) error
|
||||
Update(output string, writer io.Writer) error
|
||||
List(parts []string, output string, s string, writer io.Writer) error
|
||||
Insert(output string, s string, writer io.Writer) error
|
||||
Update(output string, s string, writer io.Writer) error
|
||||
Delete(writer io.Writer) error
|
||||
Download(writer io.Writer) error
|
||||
}
|
||||
@@ -78,7 +78,9 @@ func (c *caption) Get(parts []string) ([]*youtube.Caption, error) {
|
||||
return res.Items, nil
|
||||
}
|
||||
|
||||
func (c *caption) List(parts []string, output string, writer io.Writer) error {
|
||||
func (c *caption) List(
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
captions, err := c.Get(parts)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -86,9 +88,9 @@ func (c *caption) List(parts []string, output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(captions, writer)
|
||||
utils.PrintJSON(captions, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(captions, writer)
|
||||
utils.PrintYAML(captions, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
tb.SetOutputMirror(writer)
|
||||
@@ -108,7 +110,7 @@ func (c *caption) List(parts []string, output string, writer io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *caption) Insert(output string, writer io.Writer) error {
|
||||
func (c *caption) Insert(output string, jpath string, writer io.Writer) error {
|
||||
file, err := os.Open(c.File)
|
||||
if err != nil {
|
||||
return errors.Join(errInsertCaption, err)
|
||||
@@ -145,9 +147,9 @@ func (c *caption) Insert(output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(res, writer)
|
||||
utils.PrintJSON(res, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(res, writer)
|
||||
utils.PrintYAML(res, jpath, writer)
|
||||
case "silent":
|
||||
default:
|
||||
_, _ = fmt.Fprintf(writer, "Caption inserted: %s\n", res.Id)
|
||||
@@ -155,7 +157,7 @@ func (c *caption) Insert(output string, writer io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *caption) Update(output string, writer io.Writer) error {
|
||||
func (c *caption) Update(output string, jpath string, writer io.Writer) error {
|
||||
captions, err := c.Get([]string{"snippet"})
|
||||
if err != nil {
|
||||
return errors.Join(errUpdateCaption, err)
|
||||
@@ -219,9 +221,9 @@ func (c *caption) Update(output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(res, writer)
|
||||
utils.PrintJSON(res, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(res, writer)
|
||||
utils.PrintYAML(res, jpath, writer)
|
||||
case "silent":
|
||||
default:
|
||||
_, _ = fmt.Fprintf(writer, "Caption updated: %s\n", res.Id)
|
||||
|
||||
+10
-8
@@ -37,8 +37,8 @@ type channel struct {
|
||||
}
|
||||
|
||||
type Channel interface {
|
||||
List([]string, string, io.Writer) error
|
||||
Update(string, io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
Update(string, string, io.Writer) error
|
||||
Get([]string) ([]*youtube.Channel, error)
|
||||
}
|
||||
|
||||
@@ -105,7 +105,9 @@ func (c *channel) Get(parts []string) ([]*youtube.Channel, error) {
|
||||
return res.Items, nil
|
||||
}
|
||||
|
||||
func (c *channel) List(parts []string, output string, writer io.Writer) error {
|
||||
func (c *channel) List(
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
channels, err := c.Get(parts)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -113,9 +115,9 @@ func (c *channel) List(parts []string, output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(channels, writer)
|
||||
utils.PrintJSON(channels, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(channels, writer)
|
||||
utils.PrintYAML(channels, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
defer tb.Render()
|
||||
@@ -132,7 +134,7 @@ func (c *channel) List(parts []string, output string, writer io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *channel) Update(output string, writer io.Writer) error {
|
||||
func (c *channel) Update(output string, jpath string, writer io.Writer) error {
|
||||
parts := []string{"snippet"}
|
||||
channels, err := c.Get(parts)
|
||||
if err != nil {
|
||||
@@ -167,9 +169,9 @@ func (c *channel) Update(output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(res, writer)
|
||||
utils.PrintJSON(res, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(res, writer)
|
||||
utils.PrintYAML(res, jpath, writer)
|
||||
case "silent":
|
||||
default:
|
||||
_, _ = fmt.Fprintf(writer, "Channel updated: %s\n", res.Id)
|
||||
|
||||
@@ -24,7 +24,7 @@ type channelBanner struct {
|
||||
}
|
||||
|
||||
type ChannelBanner interface {
|
||||
Insert(string, io.Writer) error
|
||||
Insert(string, string, io.Writer) error
|
||||
}
|
||||
|
||||
type Option func(banner *channelBanner)
|
||||
@@ -39,7 +39,9 @@ func NewChannelBanner(opts ...Option) ChannelBanner {
|
||||
return cb
|
||||
}
|
||||
|
||||
func (cb *channelBanner) Insert(output string, writer io.Writer) error {
|
||||
func (cb *channelBanner) Insert(
|
||||
output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
file, err := os.Open(cb.File)
|
||||
if err != nil {
|
||||
return errors.Join(errInsertChannelBanner, err)
|
||||
@@ -62,9 +64,9 @@ func (cb *channelBanner) Insert(output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(res, writer)
|
||||
utils.PrintJSON(res, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(res, writer)
|
||||
utils.PrintYAML(res, jpath, writer)
|
||||
case "silent":
|
||||
default:
|
||||
_, _ = fmt.Fprintf(writer, "ChannelBanner inserted: %s\n", res.Url)
|
||||
|
||||
@@ -26,7 +26,7 @@ type channelSection struct {
|
||||
|
||||
type ChannelSection interface {
|
||||
Get([]string) ([]*youtube.ChannelSection, error)
|
||||
List([]string, string, io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
Delete(writer io.Writer) error
|
||||
// Update()
|
||||
// Insert()
|
||||
@@ -71,7 +71,7 @@ func (cs *channelSection) Get(parts []string) (
|
||||
}
|
||||
|
||||
func (cs *channelSection) List(
|
||||
parts []string, output string, writer io.Writer,
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
channelSections, err := cs.Get(parts)
|
||||
if err != nil {
|
||||
@@ -80,9 +80,9 @@ func (cs *channelSection) List(
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(channelSections, writer)
|
||||
utils.PrintJSON(channelSections, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(channelSections, writer)
|
||||
utils.PrintYAML(channelSections, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
defer tb.Render()
|
||||
|
||||
+26
-20
@@ -37,12 +37,12 @@ type comment struct {
|
||||
|
||||
type Comment interface {
|
||||
Get([]string) ([]*youtube.Comment, error)
|
||||
List([]string, string, io.Writer) error
|
||||
Insert(string, io.Writer) error
|
||||
Update(string, io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
Insert(string, string, io.Writer) error
|
||||
Update(string, string, io.Writer) error
|
||||
Delete(io.Writer) error
|
||||
MarkAsSpam(string, io.Writer) error
|
||||
SetModerationStatus(string, io.Writer) error
|
||||
MarkAsSpam(string, string, io.Writer) error
|
||||
SetModerationStatus(string, string, io.Writer) error
|
||||
}
|
||||
|
||||
type Option func(*comment)
|
||||
@@ -85,7 +85,9 @@ func (c *comment) Get(parts []string) ([]*youtube.Comment, error) {
|
||||
return res.Items, nil
|
||||
}
|
||||
|
||||
func (c *comment) List(parts []string, output string, writer io.Writer) error {
|
||||
func (c *comment) List(
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
comments, err := c.Get(parts)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -93,9 +95,9 @@ func (c *comment) List(parts []string, output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(comments, writer)
|
||||
utils.PrintJSON(comments, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(comments, writer)
|
||||
utils.PrintYAML(comments, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
defer tb.Render()
|
||||
@@ -115,7 +117,7 @@ func (c *comment) List(parts []string, output string, writer io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *comment) Insert(output string, writer io.Writer) error {
|
||||
func (c *comment) Insert(output string, jpath string, writer io.Writer) error {
|
||||
comment := &youtube.Comment{
|
||||
Snippet: &youtube.CommentSnippet{
|
||||
AuthorChannelId: &youtube.CommentSnippetAuthorChannelId{
|
||||
@@ -140,9 +142,9 @@ func (c *comment) Insert(output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(res, writer)
|
||||
utils.PrintJSON(res, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(res, writer)
|
||||
utils.PrintYAML(res, jpath, writer)
|
||||
case "silent":
|
||||
default:
|
||||
_, _ = fmt.Fprintf(writer, "Comment inserted: %s\n", res.Id)
|
||||
@@ -150,7 +152,7 @@ func (c *comment) Insert(output string, writer io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *comment) Update(output string, writer io.Writer) error {
|
||||
func (c *comment) Update(output string, jpath string, writer io.Writer) error {
|
||||
comments, err := c.Get([]string{"id", "snippet"})
|
||||
if err != nil {
|
||||
return errors.Join(errUpdateComment, err)
|
||||
@@ -180,9 +182,9 @@ func (c *comment) Update(output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(res, writer)
|
||||
utils.PrintJSON(res, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(res, writer)
|
||||
utils.PrintYAML(res, jpath, writer)
|
||||
case "silent":
|
||||
default:
|
||||
_, _ = fmt.Fprintf(writer, "Comment updated: %s\n", res.Id)
|
||||
@@ -190,7 +192,9 @@ func (c *comment) Update(output string, writer io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *comment) MarkAsSpam(output string, writer io.Writer) error {
|
||||
func (c *comment) MarkAsSpam(
|
||||
output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
call := service.Comments.MarkAsSpam(c.IDs)
|
||||
err := call.Do()
|
||||
if err != nil {
|
||||
@@ -199,9 +203,9 @@ func (c *comment) MarkAsSpam(output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(c, writer)
|
||||
utils.PrintJSON(c, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(c, writer)
|
||||
utils.PrintYAML(c, jpath, writer)
|
||||
case "silent":
|
||||
default:
|
||||
_, _ = fmt.Fprintf(writer, "Comment marked as spam: %s\n", c.IDs)
|
||||
@@ -209,7 +213,9 @@ func (c *comment) MarkAsSpam(output string, writer io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *comment) SetModerationStatus(output string, writer io.Writer) error {
|
||||
func (c *comment) SetModerationStatus(
|
||||
output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
call := service.Comments.SetModerationStatus(c.IDs, c.ModerationStatus)
|
||||
|
||||
if c.BanAuthor != nil {
|
||||
@@ -223,9 +229,9 @@ func (c *comment) SetModerationStatus(output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(c, writer)
|
||||
utils.PrintJSON(c, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(c, writer)
|
||||
utils.PrintYAML(c, jpath, writer)
|
||||
case "silent":
|
||||
default:
|
||||
_, _ = fmt.Fprintf(
|
||||
|
||||
@@ -32,8 +32,8 @@ type commentThread struct {
|
||||
|
||||
type CommentThread interface {
|
||||
Get([]string) ([]*youtube.CommentThread, error)
|
||||
List([]string, string, io.Writer) error
|
||||
Insert(output string, writer io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
Insert(output string, s string, writer io.Writer) error
|
||||
}
|
||||
|
||||
type Option func(*commentThread)
|
||||
@@ -97,7 +97,7 @@ func (c *commentThread) Get(parts []string) ([]*youtube.CommentThread, error) {
|
||||
}
|
||||
|
||||
func (c *commentThread) List(
|
||||
parts []string, output string, writer io.Writer,
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
commentThreads, err := c.Get(parts)
|
||||
if err != nil {
|
||||
@@ -106,9 +106,9 @@ func (c *commentThread) List(
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(commentThreads, writer)
|
||||
utils.PrintJSON(commentThreads, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(commentThreads, writer)
|
||||
utils.PrintYAML(commentThreads, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
defer tb.Render()
|
||||
@@ -129,7 +129,9 @@ func (c *commentThread) List(
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *commentThread) Insert(output string, writer io.Writer) error {
|
||||
func (c *commentThread) Insert(
|
||||
output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
ct := &youtube.CommentThread{
|
||||
Snippet: &youtube.CommentThreadSnippet{
|
||||
ChannelId: c.ChannelId,
|
||||
@@ -153,9 +155,9 @@ func (c *commentThread) Insert(output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(res, writer)
|
||||
utils.PrintJSON(res, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(res, writer)
|
||||
utils.PrintYAML(res, jpath, writer)
|
||||
case "silent":
|
||||
default:
|
||||
_, _ = fmt.Fprintf(writer, "CommentThread inserted: %s\n", res.Id)
|
||||
|
||||
@@ -20,7 +20,7 @@ type i18nLanguage struct {
|
||||
|
||||
type I18nLanguage interface {
|
||||
Get([]string) ([]*youtube.I18nLanguage, error)
|
||||
List([]string, string, io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
}
|
||||
|
||||
type Option func(*i18nLanguage)
|
||||
@@ -50,7 +50,7 @@ func (i *i18nLanguage) Get(parts []string) ([]*youtube.I18nLanguage, error) {
|
||||
}
|
||||
|
||||
func (i *i18nLanguage) List(
|
||||
parts []string, output string, writer io.Writer,
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
i18nLanguages, err := i.Get(parts)
|
||||
if err != nil {
|
||||
@@ -59,9 +59,9 @@ func (i *i18nLanguage) List(
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(i18nLanguages, writer)
|
||||
utils.PrintJSON(i18nLanguages, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(i18nLanguages, writer)
|
||||
utils.PrintYAML(i18nLanguages, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
defer tb.Render()
|
||||
|
||||
@@ -20,7 +20,7 @@ type i18nRegion struct {
|
||||
|
||||
type I18nRegion interface {
|
||||
Get([]string) ([]*youtube.I18nRegion, error)
|
||||
List([]string, string, io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
}
|
||||
|
||||
type Option func(*i18nRegion)
|
||||
@@ -50,7 +50,7 @@ func (i *i18nRegion) Get(parts []string) ([]*youtube.I18nRegion, error) {
|
||||
}
|
||||
|
||||
func (i *i18nRegion) List(
|
||||
parts []string, output string, writer io.Writer,
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
i18nRegions, err := i.Get(parts)
|
||||
if err != nil {
|
||||
@@ -59,9 +59,9 @@ func (i *i18nRegion) List(
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(i18nRegions, writer)
|
||||
utils.PrintJSON(i18nRegions, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(i18nRegions, writer)
|
||||
utils.PrintYAML(i18nRegions, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
defer tb.Render()
|
||||
|
||||
+5
-5
@@ -5,11 +5,11 @@ import (
|
||||
)
|
||||
|
||||
type Lister interface {
|
||||
List([]string, string, io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
}
|
||||
|
||||
type Inserter interface {
|
||||
Insert(string, io.Writer) error
|
||||
Insert(string, string, io.Writer) error
|
||||
}
|
||||
|
||||
type Deleter interface {
|
||||
@@ -17,13 +17,13 @@ type Deleter interface {
|
||||
}
|
||||
|
||||
type Updater interface {
|
||||
Update(string, io.Writer) error
|
||||
Update(string, string, io.Writer) error
|
||||
}
|
||||
|
||||
type Setter interface {
|
||||
Set(writer io.Writer) error
|
||||
Set(string, io.Writer) error
|
||||
}
|
||||
|
||||
type Unsetter interface {
|
||||
Unset(writer io.Writer) error
|
||||
Unset(io.Writer) error
|
||||
}
|
||||
@@ -22,7 +22,7 @@ type member struct {
|
||||
}
|
||||
|
||||
type Member interface {
|
||||
List([]string, string, io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
Get([]string) ([]*youtube.Member, error)
|
||||
}
|
||||
|
||||
@@ -62,7 +62,9 @@ func (m *member) Get(parts []string) ([]*youtube.Member, error) {
|
||||
return res.Items, nil
|
||||
}
|
||||
|
||||
func (m *member) List(parts []string, output string, writer io.Writer) error {
|
||||
func (m *member) List(
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
members, err := m.Get(parts)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -70,9 +72,9 @@ func (m *member) List(parts []string, output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(members, writer)
|
||||
utils.PrintJSON(members, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(members, writer)
|
||||
utils.PrintYAML(members, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
defer tb.Render()
|
||||
|
||||
@@ -17,7 +17,7 @@ var (
|
||||
type membershipsLevel struct{}
|
||||
|
||||
type MembershipsLevel interface {
|
||||
List([]string, string, io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
Get([]string) ([]*youtube.MembershipsLevel, error)
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ func (m *membershipsLevel) Get(parts []string) (
|
||||
}
|
||||
|
||||
func (m *membershipsLevel) List(
|
||||
parts []string, output string, writer io.Writer,
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
membershipsLevels, err := m.Get(parts)
|
||||
if err != nil {
|
||||
@@ -55,9 +55,9 @@ func (m *membershipsLevel) List(
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(membershipsLevels, writer)
|
||||
utils.PrintJSON(membershipsLevels, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(membershipsLevels, writer)
|
||||
utils.PrintYAML(membershipsLevels, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
defer tb.Render()
|
||||
|
||||
+14
-12
@@ -35,9 +35,9 @@ type playlist struct {
|
||||
}
|
||||
|
||||
type Playlist interface {
|
||||
List([]string, string, io.Writer) error
|
||||
Insert(string, io.Writer) error
|
||||
Update(string, io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
Insert(string, string, io.Writer) error
|
||||
Update(string, string, io.Writer) error
|
||||
Delete(io.Writer) error
|
||||
Get([]string) ([]*youtube.Playlist, error)
|
||||
}
|
||||
@@ -85,7 +85,9 @@ func (p *playlist) Get(parts []string) ([]*youtube.Playlist, error) {
|
||||
return res.Items, nil
|
||||
}
|
||||
|
||||
func (p *playlist) List(parts []string, output string, writer io.Writer) error {
|
||||
func (p *playlist) List(
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
playlists, err := p.Get(parts)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -93,9 +95,9 @@ func (p *playlist) List(parts []string, output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(playlists, writer)
|
||||
utils.PrintJSON(playlists, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(playlists, writer)
|
||||
utils.PrintYAML(playlists, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
defer tb.Render()
|
||||
@@ -110,7 +112,7 @@ func (p *playlist) List(parts []string, output string, writer io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *playlist) Insert(output string, writer io.Writer) error {
|
||||
func (p *playlist) Insert(output string, jpath string, writer io.Writer) error {
|
||||
upload := &youtube.Playlist{
|
||||
Snippet: &youtube.PlaylistSnippet{
|
||||
Title: p.Title,
|
||||
@@ -132,9 +134,9 @@ func (p *playlist) Insert(output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(res, writer)
|
||||
utils.PrintJSON(res, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(res, writer)
|
||||
utils.PrintYAML(res, jpath, writer)
|
||||
case "silent":
|
||||
default:
|
||||
_, _ = fmt.Fprintf(writer, "Playlist inserted: %s\n", res.Id)
|
||||
@@ -142,7 +144,7 @@ func (p *playlist) Insert(output string, writer io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *playlist) Update(output string, writer io.Writer) error {
|
||||
func (p *playlist) Update(output string, jpath string, writer io.Writer) error {
|
||||
playlists, err := p.Get([]string{"id", "snippet", "status"})
|
||||
if err != nil {
|
||||
return errors.Join(errUpdatePlaylist, err)
|
||||
@@ -176,9 +178,9 @@ func (p *playlist) Update(output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(res, writer)
|
||||
utils.PrintJSON(res, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(res, writer)
|
||||
utils.PrintYAML(res, jpath, writer)
|
||||
case "silent":
|
||||
default:
|
||||
_, _ = fmt.Fprintf(writer, "Playlist updated: %s\n", res.Id)
|
||||
|
||||
@@ -36,9 +36,9 @@ type playlistImage struct {
|
||||
|
||||
type PlaylistImage interface {
|
||||
Get([]string) ([]*youtube.PlaylistImage, error)
|
||||
List([]string, string, io.Writer) error
|
||||
Insert(string, io.Writer) error
|
||||
Update(string, io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
Insert(string, string, io.Writer) error
|
||||
Update(string, string, io.Writer) error
|
||||
Delete(io.Writer) error
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ func (pi *playlistImage) Get(parts []string) ([]*youtube.PlaylistImage, error) {
|
||||
}
|
||||
|
||||
func (pi *playlistImage) List(
|
||||
parts []string, output string, writer io.Writer,
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
playlistImages, err := pi.Get(parts)
|
||||
if err != nil {
|
||||
@@ -88,9 +88,9 @@ func (pi *playlistImage) List(
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(playlistImages, writer)
|
||||
utils.PrintJSON(playlistImages, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(playlistImages, writer)
|
||||
utils.PrintYAML(playlistImages, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
defer tb.Render()
|
||||
@@ -107,7 +107,9 @@ func (pi *playlistImage) List(
|
||||
return nil
|
||||
}
|
||||
|
||||
func (pi *playlistImage) Insert(output string, writer io.Writer) error {
|
||||
func (pi *playlistImage) Insert(
|
||||
output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
file, err := os.Open(pi.File)
|
||||
if err != nil {
|
||||
return errors.Join(errInsertPlaylistImage, err)
|
||||
@@ -140,9 +142,9 @@ func (pi *playlistImage) Insert(output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(res, writer)
|
||||
utils.PrintJSON(res, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(res, writer)
|
||||
utils.PrintYAML(res, jpath, writer)
|
||||
case "silent":
|
||||
default:
|
||||
_, _ = fmt.Fprintf(writer, "PlaylistImage inserted: %s\n", res.Id)
|
||||
@@ -150,7 +152,9 @@ func (pi *playlistImage) Insert(output string, writer io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (pi *playlistImage) Update(output string, writer io.Writer) error {
|
||||
func (pi *playlistImage) Update(
|
||||
output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
playlistImages, err := pi.Get([]string{"id", "kind", "snippet"})
|
||||
if err != nil {
|
||||
return errors.Join(errUpdatePlaylistImage, err)
|
||||
@@ -194,9 +198,9 @@ func (pi *playlistImage) Update(output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(res, writer)
|
||||
utils.PrintJSON(res, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(res, writer)
|
||||
utils.PrintYAML(res, jpath, writer)
|
||||
case "silent":
|
||||
default:
|
||||
_, _ = fmt.Fprintf(writer, "PlaylistImage updated: %s\n", res.Id)
|
||||
|
||||
@@ -36,9 +36,9 @@ type playlistItem struct {
|
||||
}
|
||||
|
||||
type PlaylistItem interface {
|
||||
List([]string, string, io.Writer) error
|
||||
Insert(string, io.Writer) error
|
||||
Update(string, io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
Insert(string, string, io.Writer) error
|
||||
Update(string, string, io.Writer) error
|
||||
Delete(io.Writer) error
|
||||
Get([]string) ([]*youtube.PlaylistItem, error)
|
||||
}
|
||||
@@ -82,7 +82,7 @@ func (pi *playlistItem) Get(parts []string) ([]*youtube.PlaylistItem, error) {
|
||||
}
|
||||
|
||||
func (pi *playlistItem) List(
|
||||
parts []string, output string, writer io.Writer,
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
playlistItems, err := pi.Get(parts)
|
||||
if err != nil {
|
||||
@@ -91,9 +91,9 @@ func (pi *playlistItem) List(
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(playlistItems, writer)
|
||||
utils.PrintJSON(playlistItems, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(playlistItems, writer)
|
||||
utils.PrintYAML(playlistItems, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
defer tb.Render()
|
||||
@@ -121,7 +121,9 @@ func (pi *playlistItem) List(
|
||||
return nil
|
||||
}
|
||||
|
||||
func (pi *playlistItem) Insert(output string, writer io.Writer) error {
|
||||
func (pi *playlistItem) Insert(
|
||||
output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
var resourceId *youtube.ResourceId
|
||||
switch pi.Kind {
|
||||
case "video":
|
||||
@@ -168,9 +170,9 @@ func (pi *playlistItem) Insert(output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(res, writer)
|
||||
utils.PrintJSON(res, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(res, writer)
|
||||
utils.PrintYAML(res, jpath, writer)
|
||||
case "silent":
|
||||
default:
|
||||
_, _ = fmt.Fprintf(writer, "Playlist Item inserted: %s\n", res.Id)
|
||||
@@ -178,7 +180,9 @@ func (pi *playlistItem) Insert(output string, writer io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (pi *playlistItem) Update(output string, writer io.Writer) error {
|
||||
func (pi *playlistItem) Update(
|
||||
output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
playlistItems, err := pi.Get([]string{"id", "snippet", "status"})
|
||||
if err != nil {
|
||||
return errors.Join(errUpdatePlaylistItem, err)
|
||||
@@ -212,9 +216,9 @@ func (pi *playlistItem) Update(output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(res, writer)
|
||||
utils.PrintJSON(res, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(res, writer)
|
||||
utils.PrintYAML(res, jpath, writer)
|
||||
case "silent":
|
||||
default:
|
||||
_, _ = fmt.Fprintf(writer, "Playlist Item updated: %s\n", res.Id)
|
||||
|
||||
@@ -48,7 +48,7 @@ type search struct {
|
||||
|
||||
type Search interface {
|
||||
Get([]string) ([]*youtube.SearchResult, error)
|
||||
List([]string, string, io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
}
|
||||
|
||||
type Option func(*search)
|
||||
@@ -190,7 +190,9 @@ func (s *search) Get(parts []string) ([]*youtube.SearchResult, error) {
|
||||
return res.Items, nil
|
||||
}
|
||||
|
||||
func (s *search) List(parts []string, output string, writer io.Writer) error {
|
||||
func (s *search) List(
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
results, err := s.Get(parts)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -198,9 +200,9 @@ func (s *search) List(parts []string, output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(results, writer)
|
||||
utils.PrintJSON(results, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(results, writer)
|
||||
utils.PrintYAML(results, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
defer tb.Render()
|
||||
|
||||
@@ -35,8 +35,8 @@ type subscription struct {
|
||||
|
||||
type Subscription interface {
|
||||
Get([]string) ([]*youtube.Subscription, error)
|
||||
List([]string, string, io.Writer) error
|
||||
Insert(string, io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
Insert(string, string, io.Writer) error
|
||||
Delete(io.Writer) error
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ func (s *subscription) Get(parts []string) ([]*youtube.Subscription, error) {
|
||||
}
|
||||
|
||||
func (s *subscription) List(
|
||||
parts []string, output string, writer io.Writer,
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
subscriptions, err := s.Get(parts)
|
||||
if err != nil {
|
||||
@@ -106,9 +106,9 @@ func (s *subscription) List(
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(subscriptions, writer)
|
||||
utils.PrintJSON(subscriptions, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(subscriptions, writer)
|
||||
utils.PrintYAML(subscriptions, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
defer tb.Render()
|
||||
@@ -136,7 +136,9 @@ func (s *subscription) List(
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *subscription) Insert(output string, writer io.Writer) error {
|
||||
func (s *subscription) Insert(
|
||||
output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
subscription := &youtube.Subscription{
|
||||
Snippet: &youtube.SubscriptionSnippet{
|
||||
ChannelId: s.SubscriberChannelId,
|
||||
@@ -156,9 +158,9 @@ func (s *subscription) Insert(output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(res, writer)
|
||||
utils.PrintJSON(res, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(res, writer)
|
||||
utils.PrintYAML(res, jpath, writer)
|
||||
default:
|
||||
_, _ = fmt.Fprintf(writer, "Subscription inserted: %s\n", res.Id)
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ type superChatEvent struct {
|
||||
|
||||
type SuperChatEvent interface {
|
||||
Get([]string) ([]*youtube.SuperChatEvent, error)
|
||||
List([]string, string, io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
}
|
||||
|
||||
type Option func(*superChatEvent)
|
||||
@@ -55,7 +55,7 @@ func (s *superChatEvent) Get(parts []string) ([]*youtube.SuperChatEvent, error)
|
||||
}
|
||||
|
||||
func (s *superChatEvent) List(
|
||||
parts []string, output string, writer io.Writer,
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
events, err := s.Get(parts)
|
||||
if err != nil {
|
||||
@@ -64,9 +64,9 @@ func (s *superChatEvent) List(
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(events, writer)
|
||||
utils.PrintJSON(events, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(events, writer)
|
||||
utils.PrintYAML(events, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
defer tb.Render()
|
||||
|
||||
@@ -21,7 +21,7 @@ type thumbnail struct {
|
||||
}
|
||||
|
||||
type Thumbnail interface {
|
||||
Set(string, io.Writer) error
|
||||
Set(string, string, io.Writer) error
|
||||
}
|
||||
|
||||
type Option func(*thumbnail)
|
||||
@@ -34,7 +34,7 @@ func NewThumbnail(opts ...Option) Thumbnail {
|
||||
return t
|
||||
}
|
||||
|
||||
func (t *thumbnail) Set(output string, writer io.Writer) error {
|
||||
func (t *thumbnail) Set(output string, jpath string, writer io.Writer) error {
|
||||
file, err := os.Open(t.File)
|
||||
if err != nil {
|
||||
return errors.Join(errSetThumbnail, err)
|
||||
@@ -48,9 +48,9 @@ func (t *thumbnail) Set(output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(res, writer)
|
||||
utils.PrintJSON(res, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(res, writer)
|
||||
utils.PrintYAML(res, jpath, writer)
|
||||
case "silent":
|
||||
default:
|
||||
_, _ = fmt.Fprintf(writer, "Thumbnail set for video %s", t.VideoId)
|
||||
|
||||
+22
-20
@@ -63,11 +63,11 @@ type video struct {
|
||||
}
|
||||
|
||||
type Video interface {
|
||||
List([]string, string, io.Writer) error
|
||||
Insert(string, io.Writer) error
|
||||
Update(string, io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
Insert(string, string, io.Writer) error
|
||||
Update(string, string, io.Writer) error
|
||||
Rate(io.Writer) error
|
||||
GetRating(string, io.Writer) error
|
||||
GetRating(string, string, io.Writer) error
|
||||
Delete(io.Writer) error
|
||||
ReportAbuse(io.Writer) error
|
||||
Get([]string) ([]*youtube.Video, error)
|
||||
@@ -131,7 +131,9 @@ func (v *video) Get(parts []string) ([]*youtube.Video, error) {
|
||||
return res.Items, nil
|
||||
}
|
||||
|
||||
func (v *video) List(parts []string, output string, writer io.Writer) error {
|
||||
func (v *video) List(
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
videos, err := v.Get(parts)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -139,9 +141,9 @@ func (v *video) List(parts []string, output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(videos, writer)
|
||||
utils.PrintJSON(videos, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(videos, writer)
|
||||
utils.PrintYAML(videos, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
defer tb.Render()
|
||||
@@ -162,7 +164,7 @@ func (v *video) List(parts []string, output string, writer io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *video) Insert(output string, writer io.Writer) error {
|
||||
func (v *video) Insert(output string, jpath string, writer io.Writer) error {
|
||||
file, err := os.Open(v.File)
|
||||
if err != nil {
|
||||
return errors.Join(errInsertVideo, err)
|
||||
@@ -234,7 +236,7 @@ func (v *video) Insert(output string, writer io.Writer) error {
|
||||
thumbnail.WithFile(v.Thumbnail),
|
||||
thumbnail.WithService(service),
|
||||
)
|
||||
t.Set("silent", nil)
|
||||
_ = t.Set("silent", "", nil)
|
||||
}
|
||||
|
||||
if v.PlaylistId != "" {
|
||||
@@ -249,14 +251,14 @@ func (v *video) Insert(output string, writer io.Writer) error {
|
||||
playlistItem.WithService(service),
|
||||
)
|
||||
|
||||
_ = pi.Insert("silent", writer)
|
||||
_ = pi.Insert("silent", "", writer)
|
||||
}
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(res, writer)
|
||||
utils.PrintJSON(res, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(res, writer)
|
||||
utils.PrintYAML(res, jpath, writer)
|
||||
case "silent":
|
||||
default:
|
||||
_, _ = fmt.Fprintf(writer, "Video inserted: %s\n", res.Id)
|
||||
@@ -264,7 +266,7 @@ func (v *video) Insert(output string, writer io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *video) Update(output string, writer io.Writer) error {
|
||||
func (v *video) Update(output string, jpath string, writer io.Writer) error {
|
||||
videos, err := v.Get([]string{"id", "snippet", "status"})
|
||||
if err != nil {
|
||||
return errors.Join(errUpdateVideo, err)
|
||||
@@ -319,7 +321,7 @@ func (v *video) Update(output string, writer io.Writer) error {
|
||||
thumbnail.WithFile(v.Thumbnail),
|
||||
thumbnail.WithService(service),
|
||||
)
|
||||
t.Set("silent", nil)
|
||||
_ = t.Set("silent", "", nil)
|
||||
}
|
||||
|
||||
if v.PlaylistId != "" {
|
||||
@@ -334,14 +336,14 @@ func (v *video) Update(output string, writer io.Writer) error {
|
||||
playlistItem.WithService(service),
|
||||
)
|
||||
|
||||
_ = pi.Insert("silent", writer)
|
||||
_ = pi.Insert("silent", "", writer)
|
||||
}
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(res, writer)
|
||||
utils.PrintJSON(res, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(res, writer)
|
||||
utils.PrintYAML(res, jpath, writer)
|
||||
case "silent":
|
||||
default:
|
||||
_, _ = fmt.Fprintf(writer, "Video updated: %s\n", res.Id)
|
||||
@@ -361,7 +363,7 @@ func (v *video) Rate(writer io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *video) GetRating(output string, writer io.Writer) error {
|
||||
func (v *video) GetRating(output string, jpath string, writer io.Writer) error {
|
||||
call := service.Videos.GetRating(v.IDs)
|
||||
if v.OnBehalfOfContentOwner != "" {
|
||||
call = call.OnBehalfOfContentOwner(v.OnBehalfOfContentOwnerChannel)
|
||||
@@ -373,9 +375,9 @@ func (v *video) GetRating(output string, writer io.Writer) error {
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(res.Items, writer)
|
||||
utils.PrintJSON(res.Items, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(res.Items, writer)
|
||||
utils.PrintYAML(res.Items, jpath, writer)
|
||||
default:
|
||||
_, _ = fmt.Fprintln(writer, "ID\tRating")
|
||||
for _, item := range res.Items {
|
||||
|
||||
@@ -20,7 +20,7 @@ type videoAbuseReportReason struct {
|
||||
|
||||
type VideoAbuseReportReason interface {
|
||||
Get([]string) ([]*youtube.VideoAbuseReportReason, error)
|
||||
List([]string, string, io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
}
|
||||
|
||||
type Option func(*videoAbuseReportReason)
|
||||
@@ -50,7 +50,7 @@ func (va *videoAbuseReportReason) Get(parts []string) (
|
||||
}
|
||||
|
||||
func (va *videoAbuseReportReason) List(
|
||||
parts []string, output string, writer io.Writer,
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
videoAbuseReportReasons, err := va.Get(parts)
|
||||
if err != nil {
|
||||
@@ -59,9 +59,9 @@ func (va *videoAbuseReportReason) List(
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(videoAbuseReportReasons, writer)
|
||||
utils.PrintJSON(videoAbuseReportReasons, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(videoAbuseReportReasons, writer)
|
||||
utils.PrintYAML(videoAbuseReportReasons, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
defer tb.Render()
|
||||
|
||||
@@ -22,7 +22,7 @@ type videoCategory struct {
|
||||
|
||||
type VideoCategory interface {
|
||||
Get([]string) ([]*youtube.VideoCategory, error)
|
||||
List([]string, string, io.Writer) error
|
||||
List([]string, string, string, io.Writer) error
|
||||
}
|
||||
|
||||
type Option func(*videoCategory)
|
||||
@@ -56,7 +56,7 @@ func (vc *videoCategory) Get(parts []string) ([]*youtube.VideoCategory, error) {
|
||||
}
|
||||
|
||||
func (vc *videoCategory) List(
|
||||
parts []string, output string, writer io.Writer,
|
||||
parts []string, output string, jpath string, writer io.Writer,
|
||||
) error {
|
||||
videoCategories, err := vc.Get(parts)
|
||||
if err != nil {
|
||||
@@ -65,9 +65,9 @@ func (vc *videoCategory) List(
|
||||
|
||||
switch output {
|
||||
case "json":
|
||||
utils.PrintJSON(videoCategories, writer)
|
||||
utils.PrintJSON(videoCategories, jpath, writer)
|
||||
case "yaml":
|
||||
utils.PrintYAML(videoCategories, writer)
|
||||
utils.PrintYAML(videoCategories, jpath, writer)
|
||||
case "table":
|
||||
tb := table.NewWriter()
|
||||
defer tb.Render()
|
||||
|
||||
@@ -26,7 +26,7 @@ type watermark struct {
|
||||
}
|
||||
|
||||
type Watermark interface {
|
||||
Set(io.Writer) error
|
||||
Set(string, io.Writer) error
|
||||
Unset(io.Writer) error
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ func NewWatermark(opts ...Option) Watermark {
|
||||
return w
|
||||
}
|
||||
|
||||
func (w *watermark) Set(writer io.Writer) error {
|
||||
func (w *watermark) Set(s string, writer io.Writer) error {
|
||||
file, err := os.Open(w.File)
|
||||
if err != nil {
|
||||
return errors.Join(errSetWatermark, err)
|
||||
|
||||
Reference in new issue
Block a user