MCPcopy Index your code
hub / github.com/peak/s5cmd / validateHeadCommand

Function validateHeadCommand

command/head.go:174–206  ·  view source on GitHub ↗
(c *cli.Context)

Source from the content-addressed store, hash-verified

172}
173
174func validateHeadCommand(c *cli.Context) error {
175 if c.Args().Len() > 1 {
176 return fmt.Errorf("object or bucket name is required")
177 }
178
179 srcurl, err := url.New(c.Args().Get(0), url.WithVersion(c.String("version-id")),
180 url.WithRaw(c.Bool("raw")))
181 if err != nil {
182 return err
183 }
184
185 if srcurl.IsPrefix() {
186 return fmt.Errorf("target have to be a object or a bucket")
187 }
188
189 if !srcurl.IsRemote() {
190 return fmt.Errorf("target should be remote object or bucket")
191 }
192
193 if srcurl.IsWildcard() && !srcurl.IsRaw() {
194 return fmt.Errorf("remote source %q can not contain glob characters", srcurl)
195 }
196
197 if err := checkVersinoningURLRemote(srcurl); err != nil {
198 return err
199 }
200
201 if err := checkVersioningWithGoogleEndpoint(c); err != nil {
202 return err
203 }
204
205 return nil
206}

Callers 1

NewHeadCommandFunction · 0.85

Calls 11

NewFunction · 0.92
WithVersionFunction · 0.92
WithRawFunction · 0.92
IsPrefixMethod · 0.80
IsRemoteMethod · 0.80
IsWildcardMethod · 0.80
IsRawMethod · 0.80
GetMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected