MCPcopy
hub / github.com/peak/s5cmd / Run

Method Run

command/mb.go:80–105  ·  view source on GitHub ↗

Run creates a bucket.

(ctx context.Context)

Source from the content-addressed store, hash-verified

78
79// Run creates a bucket.
80func (b MakeBucket) Run(ctx context.Context) error {
81 bucket, err := url.New(b.src)
82 if err != nil {
83 printError(b.fullCommand, b.op, err)
84 return err
85 }
86
87 client, err := storage.NewRemoteClient(ctx, &url.URL{}, b.storageOpts)
88 if err != nil {
89 printError(b.fullCommand, b.op, err)
90 return err
91 }
92
93 if err := client.MakeBucket(ctx, bucket.Bucket); err != nil {
94 printError(b.fullCommand, b.op, err)
95 return err
96 }
97
98 msg := log.InfoMessage{
99 Operation: b.op,
100 Source: bucket,
101 }
102 log.Info(msg)
103
104 return nil
105}
106
107func validateMBCommand(c *cli.Context) error {
108 if c.Args().Len() != 1 {

Callers 1

NewMakeBucketCommandFunction · 0.45

Calls 5

NewFunction · 0.92
NewRemoteClientFunction · 0.92
InfoFunction · 0.92
printErrorFunction · 0.85
MakeBucketMethod · 0.80

Tested by

no test coverage detected