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

Function validateCatCommand

command/cat.go:157–183  ·  view source on GitHub ↗
(c *cli.Context)

Source from the content-addressed store, hash-verified

155}
156
157func validateCatCommand(c *cli.Context) error {
158 if c.Args().Len() != 1 {
159 return fmt.Errorf("expected only one argument")
160 }
161
162 src, err := url.New(c.Args().Get(0), url.WithVersion(c.String("version-id")),
163 url.WithRaw(c.Bool("raw")))
164 if err != nil {
165 return err
166 }
167
168 if !src.IsRemote() {
169 return fmt.Errorf("source must be a remote object")
170 }
171
172 if err := checkVersioningWithGoogleEndpoint(c); err != nil {
173 return err
174 }
175
176 if src.IsWildcard() || src.IsPrefix() || src.IsBucket() {
177 if c.String("version-id") != "" {
178 return fmt.Errorf("wildcard/prefix operations are disabled with --version-id flag")
179 }
180 }
181
182 return nil
183}

Callers 1

NewCatCommandFunction · 0.85

Calls 10

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

Tested by

no test coverage detected