Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DeleteCmd = &cobra.Command{ Use: "delete <delete hash>", Short: "Delete image from Imgur by Delete Hash", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { client := utils.CreateClient() _, _, err := client.DeleteImageUnAuthed(args[0]) if err != nil { log.Fatal("Error delete image: " + err.Error()) } fmt.Println("Deleted image!") return nil }, }
View Source
var UploadCmd = &cobra.Command{ Use: "upload <path to file or url>", Short: "Upload image to Imgur", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { client := utils.CreateClient() f, err := os.Stat(args[0]) if err == nil { if f.IsDir() { log.Fatalf("%s is dir!", args[0]) } data, _, err := client.UploadImageFromFile(args[0], "") if err != nil { log.Fatal("Error upload image to Imgur: " + err.Error()) } printLink(data) } else { data, _, err := client.UploadImageFromURL(args[0], "") if err != nil { log.Fatal("Error upload image to Imgur: " + err.Error()) } printLink(data) } return nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.