-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
46 lines (39 loc) · 1.01 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"fmt"
"github.com/briandowns/spinner"
"os"
"time"
)
// Use SURF_DEBUG_HEADERS=1 environment variable to print debug headers.
/* Application defaults */
type Defaults struct {
Author, Repo, Version string
MaxForms int
}
const author = "Claudio Ramirez <pub.claudio@gmail.com>"
const repo = "https://github.com/nxadm/shib-download-file"
const version = "v0.4.3"
const maxForms = 5
var defaults = Defaults{
Author: author,
Repo: repo,
Version: version,
MaxForms: maxForms,
}
//
func main() {
/* Command line interface */
params := getParams(defaults)
fmt.Println("Downloading file...")
spinner := spinner.New(spinner.CharSets[35], 500*time.Millisecond) // Build our new spinner
spinner.Start() // Start the spinner
file, err := download(params)
spinner.Stop()
fmt.Println("")
if err != nil {
fmt.Fprintf(os.Stderr, "Error downloading the file: %s\n", err)
os.Exit(2)
}
fmt.Printf("File downloaded as %s.\n", file)
}