Skip to content

Commit

Permalink
Make description optional in info command (#165)
Browse files Browse the repository at this point in the history
Some videos have humongous descriptions, this can make the output harder to read.
  • Loading branch information
elProxy authored Apr 10, 2021
1 parent 2dc983c commit 2c3e15d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/youtubedr/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
}

0 comments on commit 2c3e15d

Please sign in to comment.