aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/hashicorp/go-getter/get.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/go-getter/get.go')
-rw-r--r--vendor/github.com/hashicorp/go-getter/get.go18
1 files changed, 12 insertions, 6 deletions
diff --git a/vendor/github.com/hashicorp/go-getter/get.go b/vendor/github.com/hashicorp/go-getter/get.go
index e6053d9..c233763 100644
--- a/vendor/github.com/hashicorp/go-getter/get.go
+++ b/vendor/github.com/hashicorp/go-getter/get.go
@@ -41,6 +41,11 @@ type Getter interface {
41 // ClientMode returns the mode based on the given URL. This is used to 41 // ClientMode returns the mode based on the given URL. This is used to
42 // allow clients to let the getters decide which mode to use. 42 // allow clients to let the getters decide which mode to use.
43 ClientMode(*url.URL) (ClientMode, error) 43 ClientMode(*url.URL) (ClientMode, error)
44
45 // SetClient allows a getter to know it's client
46 // in order to access client's Get functions or
47 // progress tracking.
48 SetClient(*Client)
44} 49}
45 50
46// Getters is the mapping of scheme to the Getter implementation that will 51// Getters is the mapping of scheme to the Getter implementation that will
@@ -62,6 +67,7 @@ func init() {
62 Getters = map[string]Getter{ 67 Getters = map[string]Getter{
63 "file": new(FileGetter), 68 "file": new(FileGetter),
64 "git": new(GitGetter), 69 "git": new(GitGetter),
70 "gcs": new(GCSGetter),
65 "hg": new(HgGetter), 71 "hg": new(HgGetter),
66 "s3": new(S3Getter), 72 "s3": new(S3Getter),
67 "http": httpGetter, 73 "http": httpGetter,
@@ -74,12 +80,12 @@ func init() {
74// 80//
75// src is a URL, whereas dst is always just a file path to a folder. This 81// src is a URL, whereas dst is always just a file path to a folder. This
76// folder doesn't need to exist. It will be created if it doesn't exist. 82// folder doesn't need to exist. It will be created if it doesn't exist.
77func Get(dst, src string) error { 83func Get(dst, src string, opts ...ClientOption) error {
78 return (&Client{ 84 return (&Client{
79 Src: src, 85 Src: src,
80 Dst: dst, 86 Dst: dst,
81 Dir: true, 87 Dir: true,
82 Getters: Getters, 88 Options: opts,
83 }).Get() 89 }).Get()
84} 90}
85 91
@@ -89,23 +95,23 @@ func Get(dst, src string) error {
89// dst must be a directory. If src is a file, it will be downloaded 95// dst must be a directory. If src is a file, it will be downloaded
90// into dst with the basename of the URL. If src is a directory or 96// into dst with the basename of the URL. If src is a directory or
91// archive, it will be unpacked directly into dst. 97// archive, it will be unpacked directly into dst.
92func GetAny(dst, src string) error { 98func GetAny(dst, src string, opts ...ClientOption) error {
93 return (&Client{ 99 return (&Client{
94 Src: src, 100 Src: src,
95 Dst: dst, 101 Dst: dst,
96 Mode: ClientModeAny, 102 Mode: ClientModeAny,
97 Getters: Getters, 103 Options: opts,
98 }).Get() 104 }).Get()
99} 105}
100 106
101// GetFile downloads the file specified by src into the path specified by 107// GetFile downloads the file specified by src into the path specified by
102// dst. 108// dst.
103func GetFile(dst, src string) error { 109func GetFile(dst, src string, opts ...ClientOption) error {
104 return (&Client{ 110 return (&Client{
105 Src: src, 111 Src: src,
106 Dst: dst, 112 Dst: dst,
107 Dir: false, 113 Dir: false,
108 Getters: Getters, 114 Options: opts,
109 }).Get() 115 }).Get()
110} 116}
111 117