From 2c3e15dba5640f0f12d09ee3eb655caf72ae5b6a Mon Sep 17 00:00:00 2001 From: elProxy Date: Sat, 10 Apr 2021 16:54:42 +0200 Subject: [PATCH] Make description optional in info command (#165) Some videos have humongous descriptions, this can make the output harder to read. --- cmd/youtubedr/info.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/youtubedr/info.go b/cmd/youtubedr/info.go index e72613c0..ae884946 100644 --- a/cmd/youtubedr/info.go +++ b/cmd/youtubedr/info.go @@ -46,7 +46,9 @@ var outputWriters = map[string]outputWriter{ fmt.Println("Title: ", info.Title) fmt.Println("Author: ", info.Author) fmt.Println("Duration: ", info.Duration) - fmt.Println("Description:", info.Description) + if printDescription { + fmt.Println("Description:", info.Description) + } fmt.Println() table := tablewriter.NewWriter(os.Stdout) @@ -122,8 +124,10 @@ var infoCmd = &cobra.Command{ } var outputFormat string +var printDescription bool func init() { rootCmd.AddCommand(infoCmd) - infoCmd.Flags().StringVarP(&outputFormat, "format", "f", "plain", "The output format (plain/json/xml).") + infoCmd.Flags().StringVarP(&outputFormat, "format", "f", "plain", "The output format (plain/json/xml)") + infoCmd.Flags().BoolVarP(&printDescription, "description", "d", false, "Print description") }