// Execute downloads the file found at a given url
Execute downloads the file found at a given url
// Execute downloads the file found at a given url
func (download Download) Execute() (result model.Result) {
	fmt.Println(download.Description)
	log.Printf("Downloading %s", download.URL)
	s := spinner.New(spinner.CharSets[9], 100*time.Millisecond)
	s.Start()
	fileName := download.URL[strings.LastIndex(download.URL, "/")+1:]
	if err := DownloadFile(download.Path+"/"+fileName, download.URL); err != nil {
		result.WasSuccessful = false
		result.Message = err.Error()
		s.Stop()
		return result
	}
	s.Stop()
	result.WasSuccessful = true
	result.Message = "downloaded"
	return result
}
func ( download Download ) Execute ( ) ( result model . Result ) { fmt . Println ( download . Description ) log . Printf ( " " , download . URL ) s := spinner . New ( spinner . CharSets [ 9 ] , 100 * time . Millisecond ) s . Start ( ) fileName := download . URL [ strings . LastIndex ( download . URL , " " ) + 1 : ] if err := DownloadFile ( download . Path + " " + fileName , download . URL ) ; err != nil { result . WasSuccessful = false result . Message = err . Error ( ) s . Stop ( ) return result } s . Stop ( ) result . WasSuccessful = true result . Message = " " return result }
Execute downloads the file found at a given url
Execute downloads the file found at a given url
// Extract the filename from the last part of the URL (everything after the last "/")