# HG changeset patch # User Mikael Berthe # Date 1521575531 -3600 # Node ID 5cb568653fc7e7e6238c54a394a3dff4fb0bf75d # Parent 488f5fc5be98b6a01653ec96d91ad68e775dbc95 media: add --description and --focus flags for attachments diff -r 488f5fc5be98 -r 5cb568653fc7 cmd/media.go --- a/cmd/media.go Tue Mar 20 19:22:14 2018 +0100 +++ b/cmd/media.go Tue Mar 20 20:52:11 2018 +0100 @@ -13,7 +13,9 @@ ) var mediaOpts struct { - filePath string + filePath string + description string + focus string } // mediaCmd represents the media command @@ -30,6 +32,9 @@ mediaCmd.Flags().StringVar(&mediaOpts.filePath, "file", "", "Path of the media file") mediaCmd.MarkFlagRequired("file") + + mediaCmd.Flags().StringVar(&mediaOpts.description, "description", "", "Plain text description") + mediaCmd.Flags().StringVar(&mediaOpts.focus, "focus", "", "Focal point") } func mediaRunE(cmd *cobra.Command, args []string) error { @@ -43,7 +48,7 @@ return err } - attachment, err := gClient.UploadMedia(opt.filePath) + attachment, err := gClient.UploadMedia(opt.filePath, opt.description, opt.focus) if err != nil { errPrint("Error: %s", err.Error()) os.Exit(1) @@ -59,7 +64,7 @@ // uploadFile uploads a media file and returns the attachment ID func uploadFile(filePath string) (int64, error) { - attachment, err := gClient.UploadMedia(filePath) + attachment, err := gClient.UploadMedia(filePath, "", "") if err != nil { return 0, err }