diff --git a/cmd/activity/activity.go b/cmd/activity/activity.go index 487ff3b..589b140 100644 --- a/cmd/activity/activity.go +++ b/cmd/activity/activity.go @@ -30,7 +30,7 @@ var ( regionCode string parts []string output string - jpath string + jsonpath string ) var activityCmd = &cobra.Command{ diff --git a/cmd/activity/list.go b/cmd/activity/list.go index f4e8ef2..9e15954 100644 --- a/cmd/activity/list.go +++ b/cmd/activity/list.go @@ -109,7 +109,7 @@ func init() { pkg.PartsUsage, ) listCmd.Flags().StringVarP(&output, "output", "o", "table", pkg.TableUsage) - listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + listCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) } var listCmd = &cobra.Command{ @@ -144,7 +144,7 @@ func listHandler( regionCode = input.RegionCode parts = input.Parts output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := list(&writer) @@ -168,5 +168,5 @@ func list(writer io.Writer, opts ...activity.Option) error { } a := activity.NewActivity(append(defaultOpts, opts...)...) - return a.List(parts, output, jpath, writer) + return a.List(parts, output, jsonpath, writer) } diff --git a/cmd/caption/caption.go b/cmd/caption/caption.go index 228e715..fa6deb6 100644 --- a/cmd/caption/caption.go +++ b/cmd/caption/caption.go @@ -47,7 +47,7 @@ var ( tfmt string tlang string output string - jpath string + jsonpath string ) var captionCmd = &cobra.Command{ diff --git a/cmd/caption/insert.go b/cmd/caption/insert.go index 2bec5a6..1b54a2c 100644 --- a/cmd/caption/insert.go +++ b/cmd/caption/insert.go @@ -172,7 +172,7 @@ func init() { &onBehalfOfContentOwner, "onBehalfOfContentOwner", "B", "", "", ) insertCmd.Flags().StringVarP(&output, "output", "o", "", pkg.SilentUsage) - insertCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", pkg.JPUsage) + insertCmd.Flags().StringVarP(&jsonpath, "jsonPath", "j", "", pkg.JPUsage) _ = insertCmd.MarkFlagRequired("file") _ = insertCmd.MarkFlagRequired("videoId") @@ -217,7 +217,7 @@ func insertHandler( onBehalfOf = input.OnBehalfOf onBehalfOfContentOwner = input.OnBehalfOfContentOwner output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := insert(&writer) @@ -246,5 +246,5 @@ func insert(writer io.Writer) error { caption.WithService(nil), ) - return c.Insert(output, jpath, writer) + return c.Insert(output, jsonpath, writer) } diff --git a/cmd/caption/list.go b/cmd/caption/list.go index 4bc2bca..11dddb6 100644 --- a/cmd/caption/list.go +++ b/cmd/caption/list.go @@ -107,7 +107,7 @@ func init() { &parts, "parts", "p", []string{"id", "snippet"}, pkg.PartsUsage, ) listCmd.Flags().StringVarP(&output, "output", "o", "table", pkg.TableUsage) - listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + listCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) } var listCmd = &cobra.Command{ @@ -139,7 +139,7 @@ func listHandler( onBehalfOfContentOwner = input.OnBehalfOfContentOwner parts = input.Parts output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := list(&writer) @@ -159,5 +159,5 @@ func list(writer io.Writer) error { caption.WithService(nil), ) - return c.List(parts, output, jpath, writer) + return c.List(parts, output, jsonpath, writer) } diff --git a/cmd/caption/update.go b/cmd/caption/update.go index 01b13df..4151b56 100644 --- a/cmd/caption/update.go +++ b/cmd/caption/update.go @@ -171,7 +171,7 @@ func init() { &onBehalfOfContentOwner, "onBehalfOfContentOwner", "B", "", "", ) updateCmd.Flags().StringVarP(&output, "output", "o", "", pkg.SilentUsage) - updateCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + updateCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) _ = updateCmd.MarkFlagRequired("videoId") } @@ -215,7 +215,7 @@ func updateHandler( onBehalfOf = input.OnBehalfOf onBehalfOfContentOwner = input.OnBehalfOfContentOwner output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := update(&writer) @@ -244,5 +244,5 @@ func update(writer io.Writer) error { caption.WithService(nil), ) - return c.Update(output, jpath, writer) + return c.Update(output, jsonpath, writer) } diff --git a/cmd/channel/channel.go b/cmd/channel/channel.go index 296c9a7..8516c3a 100644 --- a/cmd/channel/channel.go +++ b/cmd/channel/channel.go @@ -45,7 +45,7 @@ var ( title string parts []string output string - jpath string + jsonpath string onBehalfOfContentOwner string ) diff --git a/cmd/channel/list.go b/cmd/channel/list.go index 340765d..362424e 100644 --- a/cmd/channel/list.go +++ b/cmd/channel/list.go @@ -151,7 +151,7 @@ func init() { &parts, "parts", "p", []string{"id", "snippet", "status"}, pkg.PartsUsage, ) listCmd.Flags().StringVarP(&output, "output", "o", "table", pkg.TableUsage) - listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + listCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) } var listCmd = &cobra.Command{ @@ -189,7 +189,7 @@ func listHandler( onBehalfOfContentOwner = input.OnBehalfOfContentOwner parts = input.Parts output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := list(&writer) @@ -215,5 +215,5 @@ func list(writer io.Writer) error { channel.WithService(nil), ) - return c.List(parts, output, jpath, writer) + return c.List(parts, output, jsonpath, writer) } diff --git a/cmd/channel/update.go b/cmd/channel/update.go index a1460d7..613997f 100644 --- a/cmd/channel/update.go +++ b/cmd/channel/update.go @@ -104,7 +104,7 @@ func init() { ) updateCmd.Flags().StringVarP(&title, "title", "t", "", titleUsage) updateCmd.Flags().StringVarP(&output, "output", "o", "", pkg.SilentUsage) - updateCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + updateCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) _ = updateCmd.MarkFlagRequired("id") } @@ -141,7 +141,7 @@ func updateHandler( description = input.Description title = input.Title output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := update(&writer) @@ -164,5 +164,5 @@ func update(writer io.Writer) error { channel.WithService(nil), ) - return c.Update(output, jpath, writer) + return c.Update(output, jsonpath, writer) } diff --git a/cmd/channelBanner/channelBanner.go b/cmd/channelBanner/channelBanner.go index fba9826..488050b 100644 --- a/cmd/channelBanner/channelBanner.go +++ b/cmd/channelBanner/channelBanner.go @@ -19,7 +19,7 @@ var ( channelId string file string output string - jpath string + jsonpath string onBehalfOfContentOwner string onBehalfOfContentOwnerChannel string diff --git a/cmd/channelBanner/insert.go b/cmd/channelBanner/insert.go index c6acc09..83dd724 100644 --- a/cmd/channelBanner/insert.go +++ b/cmd/channelBanner/insert.go @@ -86,7 +86,7 @@ func init() { &onBehalfOfContentOwnerChannel, "onBehalfOfContentOwnerChannel", "B", "", "", ) insertCmd.Flags().StringVarP(&output, "output", "o", "", pkg.SilentUsage) - insertCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + insertCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) _ = insertCmd.MarkFlagRequired("channelId") _ = insertCmd.MarkFlagRequired("file") @@ -122,7 +122,7 @@ func insertHandler( onBehalfOfContentOwner = input.OnBehalfOfContentOwner onBehalfOfContentOwnerChannel = input.OnBehalfOfContentOwnerChannel output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := insert(&writer) @@ -142,5 +142,5 @@ func insert(writer io.Writer) error { channelBanner.WithService(nil), ) - return cb.Insert(output, jpath, writer) + return cb.Insert(output, jsonpath, writer) } diff --git a/cmd/channelSection/channelSection.go b/cmd/channelSection/channelSection.go index 0f669e4..bb5f2c5 100644 --- a/cmd/channelSection/channelSection.go +++ b/cmd/channelSection/channelSection.go @@ -25,7 +25,7 @@ var ( onBehalfOfContentOwner string parts []string output string - jpath string + jsonpath string ) var channelSectionCmd = &cobra.Command{ diff --git a/cmd/channelSection/list.go b/cmd/channelSection/list.go index 266b50e..f1a9583 100644 --- a/cmd/channelSection/list.go +++ b/cmd/channelSection/list.go @@ -108,7 +108,7 @@ func init() { &parts, "parts", "p", []string{"id", "snippet"}, pkg.PartsUsage, ) listCmd.Flags().StringVarP(&output, "output", "o", "table", pkg.TableUsage) - listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + listCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) } var listCmd = &cobra.Command{ @@ -141,7 +141,7 @@ func listHandler( onBehalfOfContentOwner = input.OnBehalfOfContentOwner parts = input.Parts output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := list(&writer) @@ -162,5 +162,5 @@ func list(writer io.Writer) error { channelSection.WithService(nil), ) - return cs.List(parts, output, jpath, writer) + return cs.List(parts, output, jsonpath, writer) } diff --git a/cmd/comment/comment.go b/cmd/comment/comment.go index 56e837e..a917867 100644 --- a/cmd/comment/comment.go +++ b/cmd/comment/comment.go @@ -39,7 +39,7 @@ var ( viewerRating string parts []string output string - jpath string + jsonpath string ) var commentCmd = &cobra.Command{ diff --git a/cmd/comment/insert.go b/cmd/comment/insert.go index c6c67fb..d3008b3 100644 --- a/cmd/comment/insert.go +++ b/cmd/comment/insert.go @@ -108,7 +108,7 @@ func init() { ) insertCmd.Flags().StringVarP(&videoId, "videoId", "v", "", vidUsage) insertCmd.Flags().StringVarP(&output, "output", "o", "", pkg.SilentUsage) - insertCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", pkg.JPUsage) + insertCmd.Flags().StringVarP(&jsonpath, "jsonPath", "j", "", pkg.JPUsage) _ = insertCmd.MarkFlagRequired("authorChannelId") _ = insertCmd.MarkFlagRequired("channelId") @@ -149,7 +149,7 @@ func insertHandler( textOriginal = input.TextOriginal videoId = input.VideoId output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := insert(&writer) @@ -171,5 +171,5 @@ func insert(writer io.Writer) error { comment.WithService(nil), ) - return c.Insert(output, jpath, writer) + return c.Insert(output, jsonpath, writer) } diff --git a/cmd/comment/list.go b/cmd/comment/list.go index bc71f39..e592b7c 100644 --- a/cmd/comment/list.go +++ b/cmd/comment/list.go @@ -104,7 +104,7 @@ func init() { &parts, "parts", "p", []string{"id", "snippet"}, pkg.PartsUsage, ) listCmd.Flags().StringVarP(&output, "output", "o", "table", pkg.TableUsage) - listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + listCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) } var listCmd = &cobra.Command{ @@ -136,7 +136,7 @@ func listHandler( textFormat = input.TextFormat parts = input.Parts output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := list(&writer) @@ -156,5 +156,5 @@ func list(writer io.Writer) error { comment.WithService(nil), ) - return c.List(parts, output, jpath, writer) + return c.List(parts, output, jsonpath, writer) } diff --git a/cmd/comment/markAsSpam.go b/cmd/comment/markAsSpam.go index d00cd4e..113717f 100644 --- a/cmd/comment/markAsSpam.go +++ b/cmd/comment/markAsSpam.go @@ -69,7 +69,7 @@ func init() { markAsSpamCmd.Flags().StringSliceVarP(&ids, "ids", "i", []string{}, idsUsage) markAsSpamCmd.Flags().StringVarP(&output, "output", "o", "", pkg.SilentUsage) - markAsSpamCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + markAsSpamCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) _ = markAsSpamCmd.MarkFlagRequired("ids") } @@ -99,7 +99,7 @@ func markAsSpamHandler( ids = input.Ids output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := markAsSpam(&writer) @@ -116,5 +116,5 @@ func markAsSpam(writer io.Writer) error { comment.WithService(nil), ) - return c.MarkAsSpam(output, jpath, writer) + return c.MarkAsSpam(output, jsonpath, writer) } diff --git a/cmd/comment/setModerationStatus.go b/cmd/comment/setModerationStatus.go index ddbefa9..7dcab41 100644 --- a/cmd/comment/setModerationStatus.go +++ b/cmd/comment/setModerationStatus.go @@ -92,7 +92,7 @@ func init() { &output, "output", "o", "", pkg.SilentUsage, ) setModerationStatusCmd.Flags().StringVarP( - &jpath, "jsonpath", "j", "", pkg.JPUsage, + &jsonpath, "jsonpath", "j", "", pkg.JPUsage, ) _ = setModerationStatusCmd.MarkFlagRequired("ids") @@ -126,7 +126,7 @@ func setModerationStatusHandler( moderationStatus = input.ModerationStatus banAuthor = utils.BoolPtr(input.BanAuthor) output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := setModerationStatus(&writer) @@ -145,5 +145,5 @@ func setModerationStatus(writer io.Writer) error { comment.WithService(nil), ) - return c.SetModerationStatus(output, jpath, writer) + return c.SetModerationStatus(output, jsonpath, writer) } diff --git a/cmd/comment/update.go b/cmd/comment/update.go index b79a174..dbce7fe 100644 --- a/cmd/comment/update.go +++ b/cmd/comment/update.go @@ -93,7 +93,7 @@ func init() { &viewerRating, "viewerRating", "r", "", vrUsage, ) updateCmd.Flags().StringVarP(&output, "output", "o", "", pkg.SilentUsage) - updateCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", pkg.JPUsage) + updateCmd.Flags().StringVarP(&jsonpath, "jsonPath", "j", "", pkg.JPUsage) _ = updateCmd.MarkFlagRequired("id") } @@ -128,7 +128,7 @@ func updateHandler( textOriginal = input.TextOriginal viewerRating = input.ViewerRating output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := update(&writer) @@ -149,5 +149,5 @@ func update(writer io.Writer) error { comment.WithService(nil), ) - return c.Update(output, jpath, writer) + return c.Update(output, jsonpath, writer) } diff --git a/cmd/commentThread/commentThread.go b/cmd/commentThread/commentThread.go index c1097d2..9f10d35 100644 --- a/cmd/commentThread/commentThread.go +++ b/cmd/commentThread/commentThread.go @@ -36,7 +36,7 @@ var ( videoId string parts []string output string - jpath string + jsonpath string ) var commentThreadCmd = &cobra.Command{ diff --git a/cmd/commentThread/insert.go b/cmd/commentThread/insert.go index 46257fe..0f7327a 100644 --- a/cmd/commentThread/insert.go +++ b/cmd/commentThread/insert.go @@ -86,7 +86,7 @@ func init() { insertCmd.Flags().StringVarP(&textOriginal, "textOriginal", "t", "", toUsage) insertCmd.Flags().StringVarP(&videoId, "videoId", "v", "", insertVidUsage) insertCmd.Flags().StringVarP(&output, "output", "o", "", pkg.SilentUsage) - insertCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + insertCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) _ = insertCmd.MarkFlagRequired("authorChannelId") _ = insertCmd.MarkFlagRequired("channelId") @@ -124,7 +124,7 @@ func insertHandler( textOriginal = input.TextOriginal videoId = input.VideoId output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := insert(&writer) @@ -144,5 +144,5 @@ func insert(writer io.Writer) error { commentThread.WithService(nil), ) - return ct.Insert(output, jpath, writer) + return ct.Insert(output, jsonpath, writer) } diff --git a/cmd/commentThread/list.go b/cmd/commentThread/list.go index 28d7400..73e32fd 100644 --- a/cmd/commentThread/list.go +++ b/cmd/commentThread/list.go @@ -136,7 +136,7 @@ func init() { &parts, "parts", "p", []string{"id", "snippet"}, pkg.PartsUsage, ) listCmd.Flags().StringVarP(&output, "output", "o", "table", pkg.TableUsage) - listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + listCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) } var listCmd = &cobra.Command{ @@ -173,7 +173,7 @@ func listHandler( videoId = input.VideoId parts = input.Parts output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := list(&writer) @@ -198,5 +198,5 @@ func list(writer io.Writer) error { commentThread.WithService(nil), ) - return ct.List(parts, output, jpath, writer) + return ct.List(parts, output, jsonpath, writer) } diff --git a/cmd/i18nLanguage/i18nLanguage.go b/cmd/i18nLanguage/i18nLanguage.go index 86db75d..62d2c93 100644 --- a/cmd/i18nLanguage/i18nLanguage.go +++ b/cmd/i18nLanguage/i18nLanguage.go @@ -23,7 +23,7 @@ var ( hl string parts []string output string - jpath string + jsonpath string defaultParts = []string{"id", "snippet"} ) diff --git a/cmd/i18nLanguage/list.go b/cmd/i18nLanguage/list.go index c1753c6..610cafb 100644 --- a/cmd/i18nLanguage/list.go +++ b/cmd/i18nLanguage/list.go @@ -47,7 +47,7 @@ func init() { &parts, "parts", "p", defaultParts, pkg.PartsUsage, ) listCmd.Flags().StringVarP(&output, "output", "o", "table", pkg.TableUsage) - listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + listCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) } var listCmd = &cobra.Command{ @@ -75,7 +75,7 @@ func hlHandler( parts = defaultParts output = "json" - jpath = "$.*.snippet.hl" + jsonpath = "$.*.snippet.hl" var writer bytes.Buffer err := list(&writer) @@ -126,5 +126,5 @@ func list(writer io.Writer) error { i18nLanguage.WithHl(hl), i18nLanguage.WithService(nil), ) - return i.List(parts, output, jpath, writer) + return i.List(parts, output, jsonpath, writer) } diff --git a/cmd/i18nRegion/i18nRegion.go b/cmd/i18nRegion/i18nRegion.go index 328ac23..e46330a 100644 --- a/cmd/i18nRegion/i18nRegion.go +++ b/cmd/i18nRegion/i18nRegion.go @@ -20,7 +20,7 @@ var ( hl string parts []string output string - jpath string + jsonpath string defaultParts = []string{"id", "snippet"} ) diff --git a/cmd/i18nRegion/list.go b/cmd/i18nRegion/list.go index bcea0ea..005bf60 100644 --- a/cmd/i18nRegion/list.go +++ b/cmd/i18nRegion/list.go @@ -36,7 +36,7 @@ func init() { &parts, "parts", "p", defaultParts, pkg.PartsUsage, ) listCmd.Flags().StringVarP(&output, "output", "o", "table", pkg.TableUsage) - listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + listCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) } var listCmd = &cobra.Command{ @@ -87,5 +87,5 @@ func list(writer io.Writer) error { i18nRegion.WithHl(hl), i18nRegion.WithService(nil), ) - return i.List(parts, output, jpath, writer) + return i.List(parts, output, jsonpath, writer) } diff --git a/cmd/member/list.go b/cmd/member/list.go index 3c2e1a4..09145aa 100644 --- a/cmd/member/list.go +++ b/cmd/member/list.go @@ -99,7 +99,7 @@ func init() { &parts, "parts", "p", []string{"snippet"}, pkg.PartsUsage, ) listCmd.Flags().StringVarP(&output, "output", "o", "table", pkg.TableUsage) - listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + listCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) } var listCmd = &cobra.Command{ @@ -131,7 +131,7 @@ func listHandler( mode = input.Mode parts = input.Parts output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := list(&writer) @@ -151,5 +151,5 @@ func list(writer io.Writer) error { member.WithService(nil), ) - return m.List(parts, output, jpath, writer) + return m.List(parts, output, jsonpath, writer) } diff --git a/cmd/member/member.go b/cmd/member/member.go index ed2b260..a28fa14 100644 --- a/cmd/member/member.go +++ b/cmd/member/member.go @@ -23,7 +23,7 @@ var ( mode string parts []string output string - jpath string + jsonpath string ) var memberCmd = &cobra.Command{ diff --git a/cmd/membershipsLevel/list.go b/cmd/membershipsLevel/list.go index 30f548c..467372a 100644 --- a/cmd/membershipsLevel/list.go +++ b/cmd/membershipsLevel/list.go @@ -69,7 +69,7 @@ func init() { &parts, "parts", "p", []string{"id", "snippet"}, pkg.PartsUsage, ) listCmd.Flags().StringVarP(&output, "output", "o", "table", pkg.TableUsage) - listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + listCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) } var listCmd = &cobra.Command{ @@ -97,7 +97,7 @@ func listHandler( parts = input.Parts output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := list(&writer) @@ -111,5 +111,5 @@ func listHandler( func list(writer io.Writer) error { m := membershipsLevel.NewMembershipsLevel(membershipsLevel.WithService(nil)) - return m.List(parts, output, jpath, writer) + return m.List(parts, output, jsonpath, writer) } diff --git a/cmd/membershipsLevel/membershipsLevel.go b/cmd/membershipsLevel/membershipsLevel.go index f16ad35..f9cffbc 100644 --- a/cmd/membershipsLevel/membershipsLevel.go +++ b/cmd/membershipsLevel/membershipsLevel.go @@ -14,9 +14,9 @@ const ( ) var ( - parts []string - output string - jpath string + parts []string + output string + jsonpath string ) var membershipsLevelCmd = &cobra.Command{ diff --git a/cmd/playlist/insert.go b/cmd/playlist/insert.go index f987fc3..0d083f7 100644 --- a/cmd/playlist/insert.go +++ b/cmd/playlist/insert.go @@ -100,7 +100,7 @@ func init() { insertCmd.Flags().StringVarP(&channelId, "channelId", "c", "", insertCidUsage) insertCmd.Flags().StringVarP(&privacy, "privacy", "p", "", privacyUsage) insertCmd.Flags().StringVarP(&output, "output", "o", "", pkg.SilentUsage) - insertCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", pkg.JPUsage) + insertCmd.Flags().StringVarP(&jsonpath, "jsonPath", "j", "", pkg.JPUsage) _ = insertCmd.MarkFlagRequired("title") _ = insertCmd.MarkFlagRequired("channelId") @@ -139,7 +139,7 @@ func insertHandler( channelId = input.ChannelId privacy = input.Privacy output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := insert(&writer) @@ -161,5 +161,5 @@ func insert(writer io.Writer) error { playlist.WithService(nil), ) - return p.Insert(output, jpath, writer) + return p.Insert(output, jsonpath, writer) } diff --git a/cmd/playlist/list.go b/cmd/playlist/list.go index 021c6a7..f1206d0 100644 --- a/cmd/playlist/list.go +++ b/cmd/playlist/list.go @@ -124,7 +124,7 @@ func init() { &parts, "parts", "p", []string{"id", "snippet", "status"}, pkg.PartsUsage, ) listCmd.Flags().StringVarP(&output, "output", "o", "table", pkg.TableUsage) - listCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", pkg.JPUsage) + listCmd.Flags().StringVarP(&jsonpath, "jsonPath", "j", "", pkg.JPUsage) } var listCmd = &cobra.Command{ @@ -159,7 +159,7 @@ func listHandler( onBehalfOfContentOwnerChannel = input.OnBehalfOfContentOwnerChannel parts = input.Parts output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := list(&writer) @@ -182,5 +182,5 @@ func list(writer io.Writer) error { playlist.WithService(nil), ) - return p.List(parts, output, jpath, writer) + return p.List(parts, output, jsonpath, writer) } diff --git a/cmd/playlist/playlist.go b/cmd/playlist/playlist.go index 241a1b9..a9ece05 100644 --- a/cmd/playlist/playlist.go +++ b/cmd/playlist/playlist.go @@ -35,7 +35,7 @@ var ( privacy string parts []string output string - jpath string + jsonpath string onBehalfOfContentOwner string onBehalfOfContentOwnerChannel string diff --git a/cmd/playlist/update.go b/cmd/playlist/update.go index c62f0d0..d523517 100644 --- a/cmd/playlist/update.go +++ b/cmd/playlist/update.go @@ -103,7 +103,7 @@ func init() { updateCmd.Flags().StringVarP(&language, "language", "l", "", languageUsage) updateCmd.Flags().StringVarP(&privacy, "privacy", "p", "", privacyUsage) updateCmd.Flags().StringVarP(&output, "output", "o", "", pkg.SilentUsage) - updateCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", pkg.JPUsage) + updateCmd.Flags().StringVarP(&jsonpath, "jsonPath", "j", "", pkg.JPUsage) _ = updateCmd.MarkFlagRequired("id") } @@ -140,7 +140,7 @@ func updateHandler( language = input.Language privacy = input.Privacy output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := update(&writer) @@ -163,5 +163,5 @@ func update(writer io.Writer) error { playlist.WithService(nil), ) - return p.Update(output, jpath, writer) + return p.Update(output, jsonpath, writer) } diff --git a/cmd/playlistImage/insert.go b/cmd/playlistImage/insert.go index 4679f32..5c19763 100644 --- a/cmd/playlistImage/insert.go +++ b/cmd/playlistImage/insert.go @@ -92,7 +92,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", "", pkg.SilentUsage) - insertCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", pkg.JPUsage) + insertCmd.Flags().StringVarP(&jsonpath, "jsonPath", "j", "", pkg.JPUsage) _ = insertCmd.MarkFlagRequired("file") _ = insertCmd.MarkFlagRequired("playlistId") @@ -129,7 +129,7 @@ func insertHandler( height = input.Height width = input.Width output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := insert(&writer) @@ -150,5 +150,5 @@ func insert(writer io.Writer) error { playlistImage.WithService(nil), ) - return pi.Insert(output, jpath, writer) + return pi.Insert(output, jsonpath, writer) } diff --git a/cmd/playlistImage/list.go b/cmd/playlistImage/list.go index 1ab9c14..0f7ba14 100644 --- a/cmd/playlistImage/list.go +++ b/cmd/playlistImage/list.go @@ -93,7 +93,7 @@ func init() { &parts, "parts", "p", []string{"id", "kind", "snippet"}, pkg.PartsUsage, ) listCmd.Flags().StringVarP(&output, "output", "o", "table", pkg.TableUsage) - listCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", pkg.JPUsage) + listCmd.Flags().StringVarP(&jsonpath, "jsonPath", "j", "", pkg.JPUsage) listCmd.Flags().StringVarP( &onBehalfOfContentOwner, "onBehalfOfContentOwner", "b", "", "", ) @@ -129,7 +129,7 @@ func listHandler( maxResults = input.MaxResults parts = input.Parts output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath onBehalfOfContentOwner = input.OnBehalfOfContentOwner onBehalfOfContentOwnerChannel = input.OnBehalfOfContentOwnerChannel @@ -151,5 +151,5 @@ func list(writer io.Writer) error { playlistImage.WithService(nil), ) - return pi.List(parts, output, jpath, writer) + return pi.List(parts, output, jsonpath, writer) } diff --git a/cmd/playlistImage/playlistImage.go b/cmd/playlistImage/playlistImage.go index 487e603..8f6e53e 100644 --- a/cmd/playlistImage/playlistImage.go +++ b/cmd/playlistImage/playlistImage.go @@ -31,7 +31,7 @@ var ( maxResults int64 parts []string output string - jpath string + jsonpath string onBehalfOfContentOwner string onBehalfOfContentOwnerChannel string diff --git a/cmd/playlistImage/update.go b/cmd/playlistImage/update.go index 1c300f5..6dbbc13 100644 --- a/cmd/playlistImage/update.go +++ b/cmd/playlistImage/update.go @@ -86,7 +86,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", "", pkg.SilentUsage) - updateCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", pkg.JPUsage) + updateCmd.Flags().StringVarP(&jsonpath, "jsonPath", "j", "", pkg.JPUsage) _ = updateCmd.MarkFlagRequired("playlistId") } @@ -121,7 +121,7 @@ func updateHandler( height = input.Height width = input.Width output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := update(&writer) @@ -142,5 +142,5 @@ func update(writer io.Writer) error { playlistImage.WithService(nil), ) - return pi.Update(output, jpath, writer) + return pi.Update(output, jsonpath, writer) } diff --git a/cmd/playlistItem/insert.go b/cmd/playlistItem/insert.go index d28d40d..fd303c1 100644 --- a/cmd/playlistItem/insert.go +++ b/cmd/playlistItem/insert.go @@ -125,7 +125,7 @@ func init() { &onBehalfOfContentOwner, "onBehalfOfContentOwner", "b", "", "", ) insertCmd.Flags().StringVarP(&output, "output", "o", "", pkg.SilentUsage) - insertCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + insertCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) _ = insertCmd.MarkFlagRequired("kind") _ = insertCmd.MarkFlagRequired("playlistId") @@ -168,7 +168,7 @@ func insertHandler( privacy = input.Privacy onBehalfOfContentOwner = input.OnBehalfOfContentOwner output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := insert(&writer) @@ -194,5 +194,5 @@ func insert(writer io.Writer) error { playlistItem.WithService(nil), ) - return pi.Insert(output, jpath, writer) + return pi.Insert(output, jsonpath, writer) } diff --git a/cmd/playlistItem/list.go b/cmd/playlistItem/list.go index bed5c3c..48e5881 100644 --- a/cmd/playlistItem/list.go +++ b/cmd/playlistItem/list.go @@ -109,7 +109,7 @@ func init() { &parts, "parts", "p", []string{"id", "snippet", "status"}, pkg.PartsUsage, ) listCmd.Flags().StringVarP(&output, "output", "o", "table", pkg.TableUsage) - listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + listCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) } var listCmd = &cobra.Command{ @@ -142,7 +142,7 @@ func listHandler( onBehalfOfContentOwner = input.OnBehalfOfContentOwner parts = input.Parts output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := list(&writer) @@ -163,5 +163,5 @@ func list(writer io.Writer) error { playlistItem.WithService(nil), ) - return pi.List(parts, output, jpath, writer) + return pi.List(parts, output, jsonpath, writer) } diff --git a/cmd/playlistItem/playlistItem.go b/cmd/playlistItem/playlistItem.go index f7e811a..76afb7a 100644 --- a/cmd/playlistItem/playlistItem.go +++ b/cmd/playlistItem/playlistItem.go @@ -37,7 +37,7 @@ var ( privacy string parts []string output string - jpath string + jsonpath string onBehalfOfContentOwner string ) diff --git a/cmd/playlistItem/update.go b/cmd/playlistItem/update.go index eb8ce6d..4351218 100644 --- a/cmd/playlistItem/update.go +++ b/cmd/playlistItem/update.go @@ -96,7 +96,7 @@ func init() { &onBehalfOfContentOwner, "onBehalfOfContentOwner", "b", "", "", ) updateCmd.Flags().StringVarP(&output, "output", "o", "", pkg.SilentUsage) - updateCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + updateCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) _ = updateCmd.MarkFlagRequired("id") } @@ -132,7 +132,7 @@ func updateHandler( privacy = input.Privacy onBehalfOfContentOwner = input.OnBehalfOfContentOwner output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := update(&writer) @@ -154,5 +154,5 @@ func update(writer io.Writer) error { playlistItem.WithService(nil), ) - return pi.Update(output, jpath, writer) + return pi.Update(output, jsonpath, writer) } diff --git a/cmd/search/list.go b/cmd/search/list.go index 49d3d8b..05d933e 100644 --- a/cmd/search/list.go +++ b/cmd/search/list.go @@ -271,7 +271,7 @@ func init() { &parts, "parts", []string{"id", "snippet"}, pkg.PartsUsage, ) listCmd.Flags().StringVar(&output, "output", "table", pkg.TableUsage) - listCmd.Flags().StringVar(&jpath, "jsonpath", "", pkg.JPUsage) + listCmd.Flags().StringVar(&jsonpath, "jsonpath", "", pkg.JPUsage) } var listCmd = &cobra.Command{ @@ -328,7 +328,7 @@ func listHandler( videoType = input.VideoType parts = input.Parts output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := list(&writer) @@ -373,5 +373,5 @@ func list(writer io.Writer) error { search.WithService(nil), ) - return s.List(parts, output, jpath, writer) + return s.List(parts, output, jsonpath, writer) } diff --git a/cmd/search/search.go b/cmd/search/search.go index 2dcc8e5..7df58f9 100644 --- a/cmd/search/search.go +++ b/cmd/search/search.go @@ -73,7 +73,7 @@ var ( videoType string parts []string output string - jpath string + jsonpath string ) var searchCmd = &cobra.Command{ diff --git a/cmd/subscription/insert.go b/cmd/subscription/insert.go index 3091624..53bbf63 100644 --- a/cmd/subscription/insert.go +++ b/cmd/subscription/insert.go @@ -87,7 +87,7 @@ func init() { insertCmd.Flags().StringVarP(&channelId, "channelId", "c", "", insertCidUsage) insertCmd.Flags().StringVarP(&title, "title", "t", "", titleUsage) insertCmd.Flags().StringVarP(&output, "output", "o", "", pkg.SilentUsage) - insertCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + insertCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) _ = insertCmd.MarkFlagRequired("subscriberChannelId") _ = insertCmd.MarkFlagRequired("channelId") @@ -123,7 +123,7 @@ func insertHandler( channelId = input.ChannelId title = input.Title output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := insert(&writer) @@ -143,5 +143,5 @@ func insert(writer io.Writer) error { subscription.WithService(nil), ) - return s.Insert(output, jpath, writer) + return s.Insert(output, jsonpath, writer) } diff --git a/cmd/subscription/list.go b/cmd/subscription/list.go index f3f5063..0458e48 100644 --- a/cmd/subscription/list.go +++ b/cmd/subscription/list.go @@ -146,7 +146,7 @@ func init() { &parts, "parts", "p", []string{"id", "snippet"}, pkg.PartsUsage, ) listCmd.Flags().StringVarP(&output, "output", "o", "table", pkg.TableUsage) - listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + listCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) } var listCmd = &cobra.Command{ @@ -184,7 +184,7 @@ func listHandler( order = input.Order parts = input.Parts output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := list(&writer) @@ -210,5 +210,5 @@ func list(writer io.Writer) error { subscription.WithService(nil), ) - return s.List(parts, output, jpath, writer) + return s.List(parts, output, jsonpath, writer) } diff --git a/cmd/subscription/subscription.go b/cmd/subscription/subscription.go index 0924984..6eab7e8 100644 --- a/cmd/subscription/subscription.go +++ b/cmd/subscription/subscription.go @@ -38,7 +38,7 @@ var ( title string parts []string output string - jpath string + jsonpath string ) var subscriptionCmd = &cobra.Command{ diff --git a/cmd/superChatEvent/list.go b/cmd/superChatEvent/list.go index f5747b7..32a5f24 100644 --- a/cmd/superChatEvent/list.go +++ b/cmd/superChatEvent/list.go @@ -82,7 +82,7 @@ func init() { &parts, "parts", "p", []string{"id", "snippet"}, pkg.PartsUsage, ) listCmd.Flags().StringVarP(&output, "output", "o", "table", pkg.TableUsage) - listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + listCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) } var listCmd = &cobra.Command{ @@ -112,7 +112,7 @@ func listHandler( maxResults = input.MaxResults parts = input.Parts output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := list(&writer) @@ -130,5 +130,5 @@ func list(writer io.Writer) error { superChatEvent.WithService(nil), ) - return sc.List(parts, output, jpath, writer) + return sc.List(parts, output, jsonpath, writer) } diff --git a/cmd/superChatEvent/superChatEvent.go b/cmd/superChatEvent/superChatEvent.go index 0f2610a..4c7693d 100644 --- a/cmd/superChatEvent/superChatEvent.go +++ b/cmd/superChatEvent/superChatEvent.go @@ -19,7 +19,7 @@ var ( maxResults int64 parts []string output string - jpath string + jsonpath string ) var superChatEventCmd = &cobra.Command{ diff --git a/cmd/thumbnail/set.go b/cmd/thumbnail/set.go index aa89730..803d846 100644 --- a/cmd/thumbnail/set.go +++ b/cmd/thumbnail/set.go @@ -70,7 +70,7 @@ func init() { setCmd.Flags().StringVarP(&file, "file", "f", "", fileUsage) setCmd.Flags().StringVarP(&videoId, "videoId", "v", "", vidUsage) setCmd.Flags().StringVarP(&output, "output", "o", "", pkg.SilentUsage) - setCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + setCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) _ = setCmd.MarkFlagRequired("file") _ = setCmd.MarkFlagRequired("videoId") @@ -102,7 +102,7 @@ func setHandler( file = input.File videoId = input.VideoId output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := set(&writer) @@ -120,5 +120,5 @@ func set(writer io.Writer) error { thumbnail.WithService(nil), ) - return t.Set(output, jpath, writer) + return t.Set(output, jsonpath, writer) } diff --git a/cmd/thumbnail/thumbnail.go b/cmd/thumbnail/thumbnail.go index 036f807..5d005bb 100644 --- a/cmd/thumbnail/thumbnail.go +++ b/cmd/thumbnail/thumbnail.go @@ -16,10 +16,10 @@ const ( ) var ( - file string - videoId string - output string - jpath string + file string + videoId string + output string + jsonpath string ) var thumbnailCmd = &cobra.Command{ diff --git a/cmd/video/getRating.go b/cmd/video/getRating.go index 65db1bb..991a6f5 100644 --- a/cmd/video/getRating.go +++ b/cmd/video/getRating.go @@ -78,7 +78,7 @@ func init() { &onBehalfOfContentOwner, "onBehalfOfContentOwner", "b", "", "", ) getRatingCmd.Flags().StringVarP(&output, "output", "o", "", pkg.TableUsage) - getRatingCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + getRatingCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) _ = getRatingCmd.MarkFlagRequired("ids") } @@ -111,7 +111,7 @@ func getRatingHandler( ids = input.Ids onBehalfOfContentOwner = input.OnBehalfOfContentOwner output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := getRating(&writer) @@ -129,5 +129,5 @@ func getRating(writer io.Writer) error { video.WithService(nil), ) - return v.GetRating(output, jpath, writer) + return v.GetRating(output, jsonpath, writer) } diff --git a/cmd/video/insert.go b/cmd/video/insert.go index f62f10e..5713032 100644 --- a/cmd/video/insert.go +++ b/cmd/video/insert.go @@ -197,7 +197,7 @@ func init() { &onBehalfOfContentOwnerChannel, "onBehalfOfContentOwnerChannel", "B", "", "", ) insertCmd.Flags().StringVarP(&output, "output", "o", "", pkg.SilentUsage) - insertCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", pkg.JPUsage) + insertCmd.Flags().StringVarP(&jsonpath, "jsonPath", "j", "", pkg.JPUsage) _ = insertCmd.MarkFlagRequired("file") _ = insertCmd.MarkFlagRequired("categoryId") @@ -250,7 +250,7 @@ func insertHandler( onBehalfOfContentOwner = input.OnBehalfOfContentOwner onBehalfOfContentOwnerChannel = input.OnBehalfOfContentOwnerChannel output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := insert(&writer) @@ -286,5 +286,5 @@ func insert(writer io.Writer) error { video.WithService(nil), ) - return v.Insert(output, jpath, writer) + return v.Insert(output, jsonpath, writer) } diff --git a/cmd/video/list.go b/cmd/video/list.go index a546a25..eb2ab63 100644 --- a/cmd/video/list.go +++ b/cmd/video/list.go @@ -147,7 +147,7 @@ func init() { &parts, "parts", "p", []string{"id", "snippet", "status"}, pkg.PartsUsage, ) listCmd.Flags().StringVarP(&output, "output", "o", "table", pkg.TableUsage) - listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + listCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) } var listCmd = &cobra.Command{ @@ -186,7 +186,7 @@ func listHandler( rating = input.MyRating parts = input.Parts output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := list(&writer) @@ -213,5 +213,5 @@ func list(writer io.Writer) error { video.WithService(nil), ) - return v.List(parts, output, jpath, writer) + return v.List(parts, output, jsonpath, writer) } diff --git a/cmd/video/update.go b/cmd/video/update.go index 2e79928..3fc0340 100644 --- a/cmd/video/update.go +++ b/cmd/video/update.go @@ -137,7 +137,7 @@ func init() { embeddable, "embeddable", "E", true, embeddableUsage, ) updateCmd.Flags().StringVarP(&output, "output", "o", "", pkg.SilentUsage) - updateCmd.Flags().StringVarP(&jpath, "jsonPath", "j", "", pkg.JPUsage) + updateCmd.Flags().StringVarP(&jsonpath, "jsonPath", "j", "", pkg.JPUsage) _ = updateCmd.MarkFlagRequired("id") } @@ -179,7 +179,7 @@ func updateHandler( privacy = input.Privacy embeddable = utils.BoolPtr(*input.Embeddable) output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := update(&writer) @@ -207,5 +207,5 @@ func update(writer io.Writer) error { video.WithService(nil), ) - return v.Update(output, jpath, writer) + return v.Update(output, jsonpath, writer) } diff --git a/cmd/video/video.go b/cmd/video/video.go index 6bed700..f25fb58 100644 --- a/cmd/video/video.go +++ b/cmd/video/video.go @@ -73,7 +73,7 @@ var ( maxResults int64 parts []string output string - jpath string + jsonpath string notifySubscribers = utils.BoolPtr("false") publicStatsViewable = utils.BoolPtr("false") diff --git a/cmd/videoAbuseReportReason/list.go b/cmd/videoAbuseReportReason/list.go index a0ffb48..fb5c0d7 100644 --- a/cmd/videoAbuseReportReason/list.go +++ b/cmd/videoAbuseReportReason/list.go @@ -80,7 +80,7 @@ func init() { &parts, "parts", "p", []string{"id", "snippet"}, pkg.PartsUsage, ) listCmd.Flags().StringVarP(&output, "output", "o", "table", pkg.TableUsage) - listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + listCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) } var listCmd = &cobra.Command{ @@ -109,7 +109,7 @@ func listHandler( hl = input.Hl parts = input.Parts output = input.Output - jpath = input.Jsonpath + jsonpath = input.Jsonpath var writer bytes.Buffer err := list(&writer) @@ -126,5 +126,5 @@ func list(writer io.Writer) error { videoAbuseReportReason.WithService(nil), ) - return va.List(parts, output, jpath, writer) + return va.List(parts, output, jsonpath, writer) } diff --git a/cmd/videoAbuseReportReason/videoAbuseReportReason.go b/cmd/videoAbuseReportReason/videoAbuseReportReason.go index 04407d0..0c54e00 100644 --- a/cmd/videoAbuseReportReason/videoAbuseReportReason.go +++ b/cmd/videoAbuseReportReason/videoAbuseReportReason.go @@ -15,10 +15,10 @@ const ( ) var ( - hl string - parts []string - output string - jpath string + hl string + parts []string + output string + jsonpath string ) var videoAbuseReportReasonCmd = &cobra.Command{ diff --git a/cmd/videoCategory/list.go b/cmd/videoCategory/list.go index 753b9bf..f0d56f4 100644 --- a/cmd/videoCategory/list.go +++ b/cmd/videoCategory/list.go @@ -39,7 +39,7 @@ func init() { &parts, "parts", "p", []string{"id", "snippet"}, pkg.PartsUsage, ) listCmd.Flags().StringVarP(&output, "output", "o", "table", pkg.TableUsage) - listCmd.Flags().StringVarP(&jpath, "jsonpath", "j", "", pkg.JPUsage) + listCmd.Flags().StringVarP(&jsonpath, "jsonpath", "j", "", pkg.JPUsage) } var listCmd = &cobra.Command{ @@ -91,5 +91,5 @@ func list(writer io.Writer) error { videoCategory.WithService(nil), ) - return vc.List(parts, output, jpath, writer) + return vc.List(parts, output, jsonpath, writer) } diff --git a/cmd/videoCategory/videoCategory.go b/cmd/videoCategory/videoCategory.go index caf95cd..315bdaa 100644 --- a/cmd/videoCategory/videoCategory.go +++ b/cmd/videoCategory/videoCategory.go @@ -24,7 +24,7 @@ var ( regionCode string parts []string output string - jpath string + jsonpath string defaultParts = []string{"id", "snippet"} ) diff --git a/pkg/activity/activity.go b/pkg/activity/activity.go index 6ac4cda..f6e060f 100644 --- a/pkg/activity/activity.go +++ b/pkg/activity/activity.go @@ -105,7 +105,7 @@ func (a *activity) Get(parts []string) ([]*youtube.Activity, error) { } func (a *activity) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { activities, err := a.Get(parts) if err != nil && activities == nil { @@ -114,9 +114,9 @@ func (a *activity) List( switch output { case "json": - utils.PrintJSON(activities, jpath, writer) + utils.PrintJSON(activities, jsonpath, writer) case "yaml": - utils.PrintYAML(activities, jpath, writer) + utils.PrintYAML(activities, jsonpath, writer) case "table": tb := table.NewWriter() defer tb.Render() diff --git a/pkg/caption/caption.go b/pkg/caption/caption.go index 3cbe4e2..c1f1e48 100644 --- a/pkg/caption/caption.go +++ b/pkg/caption/caption.go @@ -84,7 +84,7 @@ func (c *caption) Get(parts []string) ([]*youtube.Caption, error) { } func (c *caption) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { captions, err := c.Get(parts) if err != nil { @@ -93,9 +93,9 @@ func (c *caption) List( switch output { case "json": - utils.PrintJSON(captions, jpath, writer) + utils.PrintJSON(captions, jsonpath, writer) case "yaml": - utils.PrintYAML(captions, jpath, writer) + utils.PrintYAML(captions, jsonpath, writer) case "table": tb := table.NewWriter() tb.SetOutputMirror(writer) @@ -115,7 +115,7 @@ func (c *caption) List( } func (c *caption) Insert( - output string, jpath string, writer io.Writer, + output string, jsonpath string, writer io.Writer, ) error { file, err := pkg.Root.Open(c.File) if err != nil { @@ -155,9 +155,9 @@ func (c *caption) Insert( switch output { case "json": - utils.PrintJSON(res, jpath, writer) + utils.PrintJSON(res, jsonpath, writer) case "yaml": - utils.PrintYAML(res, jpath, writer) + utils.PrintYAML(res, jsonpath, writer) case "silent": default: _, _ = fmt.Fprintf(writer, "Caption inserted: %s\n", res.Id) @@ -166,7 +166,7 @@ func (c *caption) Insert( } func (c *caption) Update( - output string, jpath string, writer io.Writer, + output string, jsonpath string, writer io.Writer, ) error { captions, err := c.Get([]string{"snippet"}) if err != nil { @@ -233,9 +233,9 @@ func (c *caption) Update( switch output { case "json": - utils.PrintJSON(res, jpath, writer) + utils.PrintJSON(res, jsonpath, writer) case "yaml": - utils.PrintYAML(res, jpath, writer) + utils.PrintYAML(res, jsonpath, writer) case "silent": default: _, _ = fmt.Fprintf(writer, "Caption updated: %s\n", res.Id) diff --git a/pkg/channel/channel.go b/pkg/channel/channel.go index 9826f7a..16e8f6a 100644 --- a/pkg/channel/channel.go +++ b/pkg/channel/channel.go @@ -114,7 +114,7 @@ func (c *channel) Get(parts []string) ([]*youtube.Channel, error) { } func (c *channel) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { channels, err := c.Get(parts) if err != nil && channels == nil { @@ -123,9 +123,9 @@ func (c *channel) List( switch output { case "json": - utils.PrintJSON(channels, jpath, writer) + utils.PrintJSON(channels, jsonpath, writer) case "yaml": - utils.PrintYAML(channels, jpath, writer) + utils.PrintYAML(channels, jsonpath, writer) case "table": tb := table.NewWriter() defer tb.Render() @@ -141,7 +141,7 @@ func (c *channel) List( return err } -func (c *channel) Update(output string, jpath string, writer io.Writer) error { +func (c *channel) Update(output string, jsonpath string, writer io.Writer) error { parts := []string{"snippet"} channels, err := c.Get(parts) if err != nil { @@ -176,9 +176,9 @@ func (c *channel) Update(output string, jpath string, writer io.Writer) error { switch output { case "json": - utils.PrintJSON(res, jpath, writer) + utils.PrintJSON(res, jsonpath, writer) case "yaml": - utils.PrintYAML(res, jpath, writer) + utils.PrintYAML(res, jsonpath, writer) case "silent": default: _, _ = fmt.Fprintf(writer, "Channel updated: %s\n", res.Id) diff --git a/pkg/channelBanner/channelBanner.go b/pkg/channelBanner/channelBanner.go index 837266c..2858758 100644 --- a/pkg/channelBanner/channelBanner.go +++ b/pkg/channelBanner/channelBanner.go @@ -45,7 +45,7 @@ func NewChannelBanner(opts ...Option) ChannelBanner { } func (cb *channelBanner) Insert( - output string, jpath string, writer io.Writer, + output string, jsonpath string, writer io.Writer, ) error { file, err := pkg.Root.Open(cb.File) if err != nil { @@ -71,9 +71,9 @@ func (cb *channelBanner) Insert( switch output { case "json": - utils.PrintJSON(res, jpath, writer) + utils.PrintJSON(res, jsonpath, writer) case "yaml": - utils.PrintYAML(res, jpath, writer) + utils.PrintYAML(res, jsonpath, writer) case "silent": default: _, _ = fmt.Fprintf(writer, "ChannelBanner inserted: %s\n", res.Url) diff --git a/pkg/channelSection/channelSection.go b/pkg/channelSection/channelSection.go index 02ccf41..96b1c8d 100644 --- a/pkg/channelSection/channelSection.go +++ b/pkg/channelSection/channelSection.go @@ -76,7 +76,7 @@ func (cs *channelSection) Get(parts []string) ( } func (cs *channelSection) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { channelSections, err := cs.Get(parts) if err != nil { @@ -85,9 +85,9 @@ func (cs *channelSection) List( switch output { case "json": - utils.PrintJSON(channelSections, jpath, writer) + utils.PrintJSON(channelSections, jsonpath, writer) case "yaml": - utils.PrintYAML(channelSections, jpath, writer) + utils.PrintYAML(channelSections, jsonpath, writer) case "table": tb := table.NewWriter() defer tb.Render() diff --git a/pkg/comment/comment.go b/pkg/comment/comment.go index 4416bcd..a3fbcf5 100644 --- a/pkg/comment/comment.go +++ b/pkg/comment/comment.go @@ -100,7 +100,7 @@ func (c *comment) Get(parts []string) ([]*youtube.Comment, error) { } func (c *comment) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { comments, err := c.Get(parts) if err != nil && comments == nil { @@ -109,9 +109,9 @@ func (c *comment) List( switch output { case "json": - utils.PrintJSON(comments, jpath, writer) + utils.PrintJSON(comments, jsonpath, writer) case "yaml": - utils.PrintYAML(comments, jpath, writer) + utils.PrintYAML(comments, jsonpath, writer) case "table": tb := table.NewWriter() defer tb.Render() @@ -130,7 +130,7 @@ func (c *comment) List( return err } -func (c *comment) Insert(output string, jpath string, writer io.Writer) error { +func (c *comment) Insert(output string, jsonpath string, writer io.Writer) error { comment := &youtube.Comment{ Snippet: &youtube.CommentSnippet{ AuthorChannelId: &youtube.CommentSnippetAuthorChannelId{ @@ -155,9 +155,9 @@ func (c *comment) Insert(output string, jpath string, writer io.Writer) error { switch output { case "json": - utils.PrintJSON(res, jpath, writer) + utils.PrintJSON(res, jsonpath, writer) case "yaml": - utils.PrintYAML(res, jpath, writer) + utils.PrintYAML(res, jsonpath, writer) case "silent": default: _, _ = fmt.Fprintf(writer, "Comment inserted: %s\n", res.Id) @@ -165,7 +165,7 @@ func (c *comment) Insert(output string, jpath string, writer io.Writer) error { return nil } -func (c *comment) Update(output string, jpath string, writer io.Writer) error { +func (c *comment) Update(output string, jsonpath string, writer io.Writer) error { comments, err := c.Get([]string{"id", "snippet"}) if err != nil { return errors.Join(errUpdateComment, err) @@ -195,9 +195,9 @@ func (c *comment) Update(output string, jpath string, writer io.Writer) error { switch output { case "json": - utils.PrintJSON(res, jpath, writer) + utils.PrintJSON(res, jsonpath, writer) case "yaml": - utils.PrintYAML(res, jpath, writer) + utils.PrintYAML(res, jsonpath, writer) case "silent": default: _, _ = fmt.Fprintf(writer, "Comment updated: %s\n", res.Id) @@ -206,7 +206,7 @@ func (c *comment) Update(output string, jpath string, writer io.Writer) error { } func (c *comment) MarkAsSpam( - output string, jpath string, writer io.Writer, + output string, jsonpath string, writer io.Writer, ) error { call := service.Comments.MarkAsSpam(c.IDs) err := call.Do() @@ -216,9 +216,9 @@ func (c *comment) MarkAsSpam( switch output { case "json": - utils.PrintJSON(c, jpath, writer) + utils.PrintJSON(c, jsonpath, writer) case "yaml": - utils.PrintYAML(c, jpath, writer) + utils.PrintYAML(c, jsonpath, writer) case "silent": default: _, _ = fmt.Fprintf(writer, "Comment marked as spam: %s\n", c.IDs) @@ -227,7 +227,7 @@ func (c *comment) MarkAsSpam( } func (c *comment) SetModerationStatus( - output string, jpath string, writer io.Writer, + output string, jsonpath string, writer io.Writer, ) error { call := service.Comments.SetModerationStatus(c.IDs, c.ModerationStatus) @@ -242,9 +242,9 @@ func (c *comment) SetModerationStatus( switch output { case "json": - utils.PrintJSON(c, jpath, writer) + utils.PrintJSON(c, jsonpath, writer) case "yaml": - utils.PrintYAML(c, jpath, writer) + utils.PrintYAML(c, jsonpath, writer) case "silent": default: _, _ = fmt.Fprintf( diff --git a/pkg/commentThread/commentThread.go b/pkg/commentThread/commentThread.go index 9ca85e0..c3c458f 100644 --- a/pkg/commentThread/commentThread.go +++ b/pkg/commentThread/commentThread.go @@ -106,7 +106,7 @@ func (c *commentThread) Get(parts []string) ([]*youtube.CommentThread, error) { } func (c *commentThread) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { commentThreads, err := c.Get(parts) if err != nil && commentThreads == nil { @@ -115,9 +115,9 @@ func (c *commentThread) List( switch output { case "json": - utils.PrintJSON(commentThreads, jpath, writer) + utils.PrintJSON(commentThreads, jsonpath, writer) case "yaml": - utils.PrintYAML(commentThreads, jpath, writer) + utils.PrintYAML(commentThreads, jsonpath, writer) case "table": tb := table.NewWriter() defer tb.Render() @@ -138,7 +138,7 @@ func (c *commentThread) List( } func (c *commentThread) Insert( - output string, jpath string, writer io.Writer, + output string, jsonpath string, writer io.Writer, ) error { ct := &youtube.CommentThread{ Snippet: &youtube.CommentThreadSnippet{ @@ -163,9 +163,9 @@ func (c *commentThread) Insert( switch output { case "json": - utils.PrintJSON(res, jpath, writer) + utils.PrintJSON(res, jsonpath, writer) case "yaml": - utils.PrintYAML(res, jpath, writer) + utils.PrintYAML(res, jsonpath, writer) case "silent": default: _, _ = fmt.Fprintf(writer, "CommentThread inserted: %s\n", res.Id) diff --git a/pkg/i18nLanguage/i18nLanguage.go b/pkg/i18nLanguage/i18nLanguage.go index 475069b..5f23adf 100644 --- a/pkg/i18nLanguage/i18nLanguage.go +++ b/pkg/i18nLanguage/i18nLanguage.go @@ -57,7 +57,7 @@ func (i *i18nLanguage) Get(parts []string) ( } func (i *i18nLanguage) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { i18nLanguages, err := i.Get(parts) if err != nil { @@ -66,9 +66,9 @@ func (i *i18nLanguage) List( switch output { case "json": - utils.PrintJSON(i18nLanguages, jpath, writer) + utils.PrintJSON(i18nLanguages, jsonpath, writer) case "yaml": - utils.PrintYAML(i18nLanguages, jpath, writer) + utils.PrintYAML(i18nLanguages, jsonpath, writer) case "table": tb := table.NewWriter() defer tb.Render() diff --git a/pkg/i18nRegion/i18nRegion.go b/pkg/i18nRegion/i18nRegion.go index c2642a0..1c50c86 100644 --- a/pkg/i18nRegion/i18nRegion.go +++ b/pkg/i18nRegion/i18nRegion.go @@ -55,7 +55,7 @@ func (i *i18nRegion) Get(parts []string) ([]*youtube.I18nRegion, error) { } func (i *i18nRegion) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { i18nRegions, err := i.Get(parts) if err != nil { @@ -64,9 +64,9 @@ func (i *i18nRegion) List( switch output { case "json": - utils.PrintJSON(i18nRegions, jpath, writer) + utils.PrintJSON(i18nRegions, jsonpath, writer) case "yaml": - utils.PrintYAML(i18nRegions, jpath, writer) + utils.PrintYAML(i18nRegions, jsonpath, writer) case "table": tb := table.NewWriter() defer tb.Render() diff --git a/pkg/member/member.go b/pkg/member/member.go index 7ee7b26..fa689a7 100644 --- a/pkg/member/member.go +++ b/pkg/member/member.go @@ -81,7 +81,7 @@ func (m *member) Get(parts []string) ([]*youtube.Member, error) { } func (m *member) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { members, err := m.Get(parts) if err != nil && members == nil { @@ -90,9 +90,9 @@ func (m *member) List( switch output { case "json": - utils.PrintJSON(members, jpath, writer) + utils.PrintJSON(members, jsonpath, writer) case "yaml": - utils.PrintYAML(members, jpath, writer) + utils.PrintYAML(members, jsonpath, writer) case "table": tb := table.NewWriter() defer tb.Render() diff --git a/pkg/membershipsLevel/membershipsLevel.go b/pkg/membershipsLevel/membershipsLevel.go index 7ab7441..3883bfe 100644 --- a/pkg/membershipsLevel/membershipsLevel.go +++ b/pkg/membershipsLevel/membershipsLevel.go @@ -51,7 +51,7 @@ func (m *membershipsLevel) Get(parts []string) ( } func (m *membershipsLevel) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { membershipsLevels, err := m.Get(parts) if err != nil { @@ -60,9 +60,9 @@ func (m *membershipsLevel) List( switch output { case "json": - utils.PrintJSON(membershipsLevels, jpath, writer) + utils.PrintJSON(membershipsLevels, jsonpath, writer) case "yaml": - utils.PrintYAML(membershipsLevels, jpath, writer) + utils.PrintYAML(membershipsLevels, jsonpath, writer) case "table": tb := table.NewWriter() defer tb.Render() diff --git a/pkg/playlist/playlist.go b/pkg/playlist/playlist.go index ee8bfbe..15a28fa 100644 --- a/pkg/playlist/playlist.go +++ b/pkg/playlist/playlist.go @@ -104,7 +104,7 @@ func (p *playlist) Get(parts []string) ([]*youtube.Playlist, error) { } func (p *playlist) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { playlists, err := p.Get(parts) if err != nil && playlists == nil { @@ -113,9 +113,9 @@ func (p *playlist) List( switch output { case "json": - utils.PrintJSON(playlists, jpath, writer) + utils.PrintJSON(playlists, jsonpath, writer) case "yaml": - utils.PrintYAML(playlists, jpath, writer) + utils.PrintYAML(playlists, jsonpath, writer) case "table": tb := table.NewWriter() defer tb.Render() @@ -129,7 +129,7 @@ func (p *playlist) List( return err } -func (p *playlist) Insert(output string, jpath string, writer io.Writer) error { +func (p *playlist) Insert(output string, jsonpath string, writer io.Writer) error { upload := &youtube.Playlist{ Snippet: &youtube.PlaylistSnippet{ Title: p.Title, @@ -151,9 +151,9 @@ func (p *playlist) Insert(output string, jpath string, writer io.Writer) error { switch output { case "json": - utils.PrintJSON(res, jpath, writer) + utils.PrintJSON(res, jsonpath, writer) case "yaml": - utils.PrintYAML(res, jpath, writer) + utils.PrintYAML(res, jsonpath, writer) case "silent": default: _, _ = fmt.Fprintf(writer, "Playlist inserted: %s\n", res.Id) @@ -161,7 +161,7 @@ func (p *playlist) Insert(output string, jpath string, writer io.Writer) error { return nil } -func (p *playlist) Update(output string, jpath string, writer io.Writer) error { +func (p *playlist) Update(output string, jsonpath string, writer io.Writer) error { playlists, err := p.Get([]string{"id", "snippet", "status"}) if err != nil { return errors.Join(errUpdatePlaylist, err) @@ -195,9 +195,9 @@ func (p *playlist) Update(output string, jpath string, writer io.Writer) error { switch output { case "json": - utils.PrintJSON(res, jpath, writer) + utils.PrintJSON(res, jsonpath, writer) case "yaml": - utils.PrintYAML(res, jpath, writer) + utils.PrintYAML(res, jsonpath, writer) case "silent": default: _, _ = fmt.Fprintf(writer, "Playlist updated: %s\n", res.Id) diff --git a/pkg/playlistImage/playlistImage.go b/pkg/playlistImage/playlistImage.go index 864b28f..708c092 100644 --- a/pkg/playlistImage/playlistImage.go +++ b/pkg/playlistImage/playlistImage.go @@ -96,7 +96,7 @@ func (pi *playlistImage) Get(parts []string) ([]*youtube.PlaylistImage, error) { } func (pi *playlistImage) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { playlistImages, err := pi.Get(parts) if err != nil && playlistImages == nil { @@ -105,9 +105,9 @@ func (pi *playlistImage) List( switch output { case "json": - utils.PrintJSON(playlistImages, jpath, writer) + utils.PrintJSON(playlistImages, jsonpath, writer) case "yaml": - utils.PrintYAML(playlistImages, jpath, writer) + utils.PrintYAML(playlistImages, jsonpath, writer) case "table": tb := table.NewWriter() defer tb.Render() @@ -124,7 +124,7 @@ func (pi *playlistImage) List( } func (pi *playlistImage) Insert( - output string, jpath string, writer io.Writer, + output string, jsonpath string, writer io.Writer, ) error { file, err := pkg.Root.Open(pi.File) if err != nil { @@ -160,9 +160,9 @@ func (pi *playlistImage) Insert( switch output { case "json": - utils.PrintJSON(res, jpath, writer) + utils.PrintJSON(res, jsonpath, writer) case "yaml": - utils.PrintYAML(res, jpath, writer) + utils.PrintYAML(res, jsonpath, writer) case "silent": default: _, _ = fmt.Fprintf(writer, "PlaylistImage inserted: %s\n", res.Id) @@ -171,7 +171,7 @@ func (pi *playlistImage) Insert( } func (pi *playlistImage) Update( - output string, jpath string, writer io.Writer, + output string, jsonpath string, writer io.Writer, ) error { playlistImages, err := pi.Get([]string{"id", "kind", "snippet"}) if err != nil { @@ -218,9 +218,9 @@ func (pi *playlistImage) Update( switch output { case "json": - utils.PrintJSON(res, jpath, writer) + utils.PrintJSON(res, jsonpath, writer) case "yaml": - utils.PrintYAML(res, jpath, writer) + utils.PrintYAML(res, jsonpath, writer) case "silent": default: _, _ = fmt.Fprintf(writer, "PlaylistImage updated: %s\n", res.Id) diff --git a/pkg/playlistItem/playlistItem.go b/pkg/playlistItem/playlistItem.go index 197a038..2bdc088 100644 --- a/pkg/playlistItem/playlistItem.go +++ b/pkg/playlistItem/playlistItem.go @@ -101,7 +101,7 @@ func (pi *playlistItem) Get(parts []string) ([]*youtube.PlaylistItem, error) { } func (pi *playlistItem) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { playlistItems, err := pi.Get(parts) if err != nil && playlistItems == nil { @@ -110,9 +110,9 @@ func (pi *playlistItem) List( switch output { case "json": - utils.PrintJSON(playlistItems, jpath, writer) + utils.PrintJSON(playlistItems, jsonpath, writer) case "yaml": - utils.PrintYAML(playlistItems, jpath, writer) + utils.PrintYAML(playlistItems, jsonpath, writer) case "table": tb := table.NewWriter() defer tb.Render() @@ -140,7 +140,7 @@ func (pi *playlistItem) List( } func (pi *playlistItem) Insert( - output string, jpath string, writer io.Writer, + output string, jsonpath string, writer io.Writer, ) error { var resourceId *youtube.ResourceId switch pi.Kind { @@ -188,9 +188,9 @@ func (pi *playlistItem) Insert( switch output { case "json": - utils.PrintJSON(res, jpath, writer) + utils.PrintJSON(res, jsonpath, writer) case "yaml": - utils.PrintYAML(res, jpath, writer) + utils.PrintYAML(res, jsonpath, writer) case "silent": default: _, _ = fmt.Fprintf(writer, "Playlist Item inserted: %s\n", res.Id) @@ -199,7 +199,7 @@ func (pi *playlistItem) Insert( } func (pi *playlistItem) Update( - output string, jpath string, writer io.Writer, + output string, jsonpath string, writer io.Writer, ) error { playlistItems, err := pi.Get([]string{"id", "snippet", "status"}) if err != nil { @@ -234,9 +234,9 @@ func (pi *playlistItem) Update( switch output { case "json": - utils.PrintJSON(res, jpath, writer) + utils.PrintJSON(res, jsonpath, writer) case "yaml": - utils.PrintYAML(res, jpath, writer) + utils.PrintYAML(res, jsonpath, writer) case "silent": default: _, _ = fmt.Fprintf(writer, "Playlist Item updated: %s\n", res.Id) diff --git a/pkg/search/search.go b/pkg/search/search.go index ded697a..46370a6 100644 --- a/pkg/search/search.go +++ b/pkg/search/search.go @@ -181,7 +181,7 @@ func (s *search) Get(parts []string) ([]*youtube.SearchResult, error) { } func (s *search) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { results, err := s.Get(parts) if err != nil && results == nil { @@ -190,9 +190,9 @@ func (s *search) List( switch output { case "json": - utils.PrintJSON(results, jpath, writer) + utils.PrintJSON(results, jsonpath, writer) case "yaml": - utils.PrintYAML(results, jpath, writer) + utils.PrintYAML(results, jsonpath, writer) case "table": tb := table.NewWriter() defer tb.Render() diff --git a/pkg/subscription/subscription.go b/pkg/subscription/subscription.go index f68e19f..38989d3 100644 --- a/pkg/subscription/subscription.go +++ b/pkg/subscription/subscription.go @@ -113,7 +113,7 @@ func (s *subscription) Get(parts []string) ([]*youtube.Subscription, error) { } func (s *subscription) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { subscriptions, err := s.Get(parts) if err != nil && subscriptions == nil { @@ -122,9 +122,9 @@ func (s *subscription) List( switch output { case "json": - utils.PrintJSON(subscriptions, jpath, writer) + utils.PrintJSON(subscriptions, jsonpath, writer) case "yaml": - utils.PrintYAML(subscriptions, jpath, writer) + utils.PrintYAML(subscriptions, jsonpath, writer) case "table": tb := table.NewWriter() defer tb.Render() @@ -152,7 +152,7 @@ func (s *subscription) List( } func (s *subscription) Insert( - output string, jpath string, writer io.Writer, + output string, jsonpath string, writer io.Writer, ) error { subscription := &youtube.Subscription{ Snippet: &youtube.SubscriptionSnippet{ @@ -173,9 +173,9 @@ func (s *subscription) Insert( switch output { case "json": - utils.PrintJSON(res, jpath, writer) + utils.PrintJSON(res, jsonpath, writer) case "yaml": - utils.PrintYAML(res, jpath, writer) + utils.PrintYAML(res, jsonpath, writer) default: _, _ = fmt.Fprintf(writer, "Subscription inserted: %s\n", res.Id) } diff --git a/pkg/superChatEvent/superChatEvent.go b/pkg/superChatEvent/superChatEvent.go index 1511559..4ea3c0b 100644 --- a/pkg/superChatEvent/superChatEvent.go +++ b/pkg/superChatEvent/superChatEvent.go @@ -73,7 +73,7 @@ func (s *superChatEvent) Get(parts []string) ([]*youtube.SuperChatEvent, error) } func (s *superChatEvent) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { events, err := s.Get(parts) if err != nil && events == nil { @@ -82,9 +82,9 @@ func (s *superChatEvent) List( switch output { case "json": - utils.PrintJSON(events, jpath, writer) + utils.PrintJSON(events, jsonpath, writer) case "yaml": - utils.PrintYAML(events, jpath, writer) + utils.PrintYAML(events, jsonpath, writer) case "table": tb := table.NewWriter() defer tb.Render() diff --git a/pkg/thumbnail/thumbnail.go b/pkg/thumbnail/thumbnail.go index 31cd7aa..4ed2f43 100644 --- a/pkg/thumbnail/thumbnail.go +++ b/pkg/thumbnail/thumbnail.go @@ -38,7 +38,7 @@ func NewThumbnail(opts ...Option) Thumbnail { return t } -func (t *thumbnail) Set(output string, jpath string, writer io.Writer) error { +func (t *thumbnail) Set(output string, jsonpath string, writer io.Writer) error { file, err := pkg.Root.Open(t.File) if err != nil { return errors.Join(errSetThumbnail, err) @@ -52,9 +52,9 @@ func (t *thumbnail) Set(output string, jpath string, writer io.Writer) error { switch output { case "json": - utils.PrintJSON(res, jpath, writer) + utils.PrintJSON(res, jsonpath, writer) case "yaml": - utils.PrintYAML(res, jpath, writer) + utils.PrintYAML(res, jsonpath, writer) case "silent": default: _, _ = fmt.Fprintf(writer, "Thumbnail set for video %s", t.VideoId) diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index a1d91b9..0736db8 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -22,24 +22,24 @@ import ( "gopkg.in/yaml.v3" ) -func PrintJSON(data interface{}, jpath string, writer io.Writer) { - j, err := jp.ParseString(jpath) - if err != nil && jpath != "" { - _, _ = fmt.Fprintln(writer, "Invalid JSONPath:", jpath) +func PrintJSON(data interface{}, jsonpath string, writer io.Writer) { + j, err := jp.ParseString(jsonpath) + if err != nil && jsonpath != "" { + _, _ = fmt.Fprintln(writer, "Invalid JSONPath:", jsonpath) return - } else if jpath != "" { + } else if jsonpath != "" { data = j.Get(data) } marshalled, _ := json.MarshalIndent(data, "", " ") _, _ = fmt.Fprintln(writer, string(marshalled)) } -func PrintYAML(data interface{}, jpath string, writer io.Writer) { - j, err := jp.ParseString(jpath) - if err != nil && jpath != "" { - _, _ = fmt.Fprintln(writer, "Invalid JSONPath:", jpath) +func PrintYAML(data interface{}, jsonpath string, writer io.Writer) { + j, err := jp.ParseString(jsonpath) + if err != nil && jsonpath != "" { + _, _ = fmt.Fprintln(writer, "Invalid JSONPath:", jsonpath) return - } else if jpath != "" { + } else if jsonpath != "" { data = j.Get(data) } marshalled, _ := yaml.Marshal(data) diff --git a/pkg/utils/utils_test.go b/pkg/utils/utils_test.go index 0b98e99..5490df0 100644 --- a/pkg/utils/utils_test.go +++ b/pkg/utils/utils_test.go @@ -118,8 +118,8 @@ func TestIsJson(t *testing.T) { func TestPrintJSON(t *testing.T) { type args struct { - data interface{} - jpath string + data interface{} + jsonpath string } tests := []struct { name string @@ -128,18 +128,18 @@ func TestPrintJSON(t *testing.T) { }{ { name: "empty jsonpath", - args: args{data: map[string]string{"key": "value"}, jpath: ""}, + args: args{data: map[string]string{"key": "value"}, jsonpath: ""}, wantWriter: "{\n \"key\": \"value\"\n}\n", }, { name: "simple json", - args: args{data: map[string]string{"key": "value"}, jpath: "$"}, + args: args{data: map[string]string{"key": "value"}, jsonpath: "$"}, wantWriter: "[\n {\n \"key\": \"value\"\n }\n]\n", }, { name: "invalid jsonpath", args: args{ - data: map[string]string{"key": "value"}, jpath: "//", + data: map[string]string{"key": "value"}, jsonpath: "//", }, wantWriter: "Invalid JSONPath: //\n", }, @@ -149,7 +149,7 @@ func TestPrintJSON(t *testing.T) { data: map[string]interface{}{ "key": "value", "another": "field", - }, jpath: "$.key", + }, jsonpath: "$.key", }, wantWriter: "[\n \"value\"\n]\n", }, @@ -161,7 +161,7 @@ func TestPrintJSON(t *testing.T) { "item2": map[string]string{"key2": "value2"}, "count": 2, }, - jpath: "$.*.key1", + jsonpath: "$.*.key1", }, wantWriter: "[\n \"value1\"\n]\n", }, @@ -173,13 +173,13 @@ func TestPrintJSON(t *testing.T) { {"key2": "value2"}, {"key1": "value3"}, }, - jpath: "$[*].key1", + jsonpath: "$[*].key1", }, wantWriter: "[\n \"value1\",\n \"value3\"\n]\n", }, { name: "nil data", - args: args{data: nil, jpath: "$"}, + args: args{data: nil, jsonpath: "$"}, wantWriter: "[\n null\n]\n", }, } @@ -187,7 +187,7 @@ func TestPrintJSON(t *testing.T) { t.Run( tt.name, func(t *testing.T) { writer := &bytes.Buffer{} - PrintJSON(tt.args.data, tt.args.jpath, writer) + PrintJSON(tt.args.data, tt.args.jsonpath, writer) if gotWriter := writer.String(); gotWriter != tt.wantWriter { t.Errorf("PrintJSON() = %v, want %v", gotWriter, tt.wantWriter) } @@ -198,8 +198,8 @@ func TestPrintJSON(t *testing.T) { func TestPrintYAML(t *testing.T) { type args struct { - data interface{} - jpath string + data interface{} + jsonpath string } tests := []struct { name string @@ -208,18 +208,18 @@ func TestPrintYAML(t *testing.T) { }{ { name: "empty jsonpath", - args: args{data: map[string]string{"key": "value"}, jpath: ""}, + args: args{data: map[string]string{"key": "value"}, jsonpath: ""}, wantWriter: "key: value\n\n", }, { name: "simple yaml", - args: args{data: map[string]string{"key": "value"}, jpath: "$"}, + args: args{data: map[string]string{"key": "value"}, jsonpath: "$"}, wantWriter: "- key: value\n\n", }, { name: "invalid jsonpath", args: args{ - data: map[string]string{"key": "value"}, jpath: "//", + data: map[string]string{"key": "value"}, jsonpath: "//", }, wantWriter: "Invalid JSONPath: //\n", }, @@ -229,7 +229,7 @@ func TestPrintYAML(t *testing.T) { data: map[string]interface{}{ "key": "value", "another": "field", - }, jpath: "$.key", + }, jsonpath: "$.key", }, wantWriter: "- value\n\n", }, @@ -241,7 +241,7 @@ func TestPrintYAML(t *testing.T) { "item2": map[string]string{"key2": "value2"}, "count": 2, }, - jpath: "$.*.key1", + jsonpath: "$.*.key1", }, wantWriter: "- value1\n\n", }, @@ -253,13 +253,13 @@ func TestPrintYAML(t *testing.T) { {"key2": "value2"}, {"key1": "value3"}, }, - jpath: "$[*].key1", + jsonpath: "$[*].key1", }, wantWriter: "- value1\n- value3\n\n", }, { name: "nil data", - args: args{data: nil, jpath: "$"}, + args: args{data: nil, jsonpath: "$"}, wantWriter: "- null\n\n", }, } @@ -267,7 +267,7 @@ func TestPrintYAML(t *testing.T) { t.Run( tt.name, func(t *testing.T) { writer := &bytes.Buffer{} - PrintYAML(tt.args.data, tt.args.jpath, writer) + PrintYAML(tt.args.data, tt.args.jsonpath, writer) if gotWriter := writer.String(); gotWriter != tt.wantWriter { t.Errorf("PrintYAML() = %v, want %v", gotWriter, tt.wantWriter) } diff --git a/pkg/video/video.go b/pkg/video/video.go index d048727..b0087d0 100644 --- a/pkg/video/video.go +++ b/pkg/video/video.go @@ -149,7 +149,7 @@ func (v *video) Get(parts []string) ([]*youtube.Video, error) { } func (v *video) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { videos, err := v.Get(parts) if err != nil && videos == nil { @@ -158,9 +158,9 @@ func (v *video) List( switch output { case "json": - utils.PrintJSON(videos, jpath, writer) + utils.PrintJSON(videos, jsonpath, writer) case "yaml": - utils.PrintYAML(videos, jpath, writer) + utils.PrintYAML(videos, jsonpath, writer) case "table": tb := table.NewWriter() defer tb.Render() @@ -180,7 +180,7 @@ func (v *video) List( return err } -func (v *video) Insert(output string, jpath string, writer io.Writer) error { +func (v *video) Insert(output string, jsonpath string, writer io.Writer) error { file, err := pkg.Root.Open(v.File) if err != nil { return errors.Join(errInsertVideo, err) @@ -274,9 +274,9 @@ func (v *video) Insert(output string, jpath string, writer io.Writer) error { switch output { case "json": - utils.PrintJSON(res, jpath, writer) + utils.PrintJSON(res, jsonpath, writer) case "yaml": - utils.PrintYAML(res, jpath, writer) + utils.PrintYAML(res, jsonpath, writer) case "silent": default: _, _ = fmt.Fprintf(writer, "Video inserted: %s\n", res.Id) @@ -284,7 +284,7 @@ func (v *video) Insert(output string, jpath string, writer io.Writer) error { return nil } -func (v *video) Update(output string, jpath string, writer io.Writer) error { +func (v *video) Update(output string, jsonpath string, writer io.Writer) error { videos, err := v.Get([]string{"id", "snippet", "status"}) if err != nil { return errors.Join(errUpdateVideo, err) @@ -359,9 +359,9 @@ func (v *video) Update(output string, jpath string, writer io.Writer) error { switch output { case "json": - utils.PrintJSON(res, jpath, writer) + utils.PrintJSON(res, jsonpath, writer) case "yaml": - utils.PrintYAML(res, jpath, writer) + utils.PrintYAML(res, jsonpath, writer) case "silent": default: _, _ = fmt.Fprintf(writer, "Video updated: %s\n", res.Id) @@ -381,7 +381,7 @@ func (v *video) Rate(writer io.Writer) error { return nil } -func (v *video) GetRating(output string, jpath string, writer io.Writer) error { +func (v *video) GetRating(output string, jsonpath string, writer io.Writer) error { call := service.Videos.GetRating(v.IDs) if v.OnBehalfOfContentOwner != "" { call = call.OnBehalfOfContentOwner(v.OnBehalfOfContentOwnerChannel) @@ -393,9 +393,9 @@ func (v *video) GetRating(output string, jpath string, writer io.Writer) error { switch output { case "json": - utils.PrintJSON(res.Items, jpath, writer) + utils.PrintJSON(res.Items, jsonpath, writer) case "yaml": - utils.PrintYAML(res.Items, jpath, writer) + utils.PrintYAML(res.Items, jsonpath, writer) default: tb := table.NewWriter() defer tb.Render() diff --git a/pkg/videoAbuseReportReason/videoAbuseReportReason.go b/pkg/videoAbuseReportReason/videoAbuseReportReason.go index a8a43a0..549abb9 100644 --- a/pkg/videoAbuseReportReason/videoAbuseReportReason.go +++ b/pkg/videoAbuseReportReason/videoAbuseReportReason.go @@ -55,7 +55,7 @@ func (va *videoAbuseReportReason) Get(parts []string) ( } func (va *videoAbuseReportReason) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { videoAbuseReportReasons, err := va.Get(parts) if err != nil { @@ -64,9 +64,9 @@ func (va *videoAbuseReportReason) List( switch output { case "json": - utils.PrintJSON(videoAbuseReportReasons, jpath, writer) + utils.PrintJSON(videoAbuseReportReasons, jsonpath, writer) case "yaml": - utils.PrintYAML(videoAbuseReportReasons, jpath, writer) + utils.PrintYAML(videoAbuseReportReasons, jsonpath, writer) case "table": tb := table.NewWriter() defer tb.Render() diff --git a/pkg/videoCategory/videoCategory.go b/pkg/videoCategory/videoCategory.go index bc0de9d..456817c 100644 --- a/pkg/videoCategory/videoCategory.go +++ b/pkg/videoCategory/videoCategory.go @@ -61,7 +61,7 @@ func (vc *videoCategory) Get(parts []string) ([]*youtube.VideoCategory, error) { } func (vc *videoCategory) List( - parts []string, output string, jpath string, writer io.Writer, + parts []string, output string, jsonpath string, writer io.Writer, ) error { videoCategories, err := vc.Get(parts) if err != nil { @@ -70,9 +70,9 @@ func (vc *videoCategory) List( switch output { case "json": - utils.PrintJSON(videoCategories, jpath, writer) + utils.PrintJSON(videoCategories, jsonpath, writer) case "yaml": - utils.PrintYAML(videoCategories, jpath, writer) + utils.PrintYAML(videoCategories, jsonpath, writer) case "table": tb := table.NewWriter() defer tb.Render()