mirror of
https://codeberg.org/scip/ephemerup.git
synced 2025-12-17 12:40:57 +01:00
enhanced output
This commit is contained in:
@@ -145,17 +145,15 @@ func UploadFiles(c *cfg.Config, args []string) error {
|
||||
}, 10*time.Millisecond).
|
||||
Post(rq.Url)
|
||||
|
||||
fmt.Println("")
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return HandleResponse(c, resp)
|
||||
return printUploadsResponse(resp)
|
||||
}
|
||||
|
||||
func HandleResponse(c *cfg.Config, resp *req.Response) error {
|
||||
// we expect a json response
|
||||
// we expect a json response, extract the error, if any
|
||||
r := Response{}
|
||||
|
||||
if err := json.Unmarshal([]byte(resp.String()), &r); err != nil {
|
||||
@@ -252,6 +250,10 @@ func Describe(c *cfg.Config, args []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
return printUploadsResponse(resp)
|
||||
}
|
||||
|
||||
func printUploadsResponse(resp *req.Response) error {
|
||||
uploads := Uploads{}
|
||||
|
||||
if err := json.Unmarshal([]byte(resp.String()), &uploads); err != nil {
|
||||
@@ -262,6 +264,10 @@ func Describe(c *cfg.Config, args []string) error {
|
||||
return errors.New(uploads.Message)
|
||||
}
|
||||
|
||||
if uploads.Message != "" {
|
||||
fmt.Println(uploads.Message)
|
||||
}
|
||||
|
||||
WriteExtended(&uploads)
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user