storj/cmd/uplinkng/cmd_mb.go
Jeff Wendling f474bb6179 cmd/uplinkng: update for breaking clingy changes
clingy changed some and this is just fixes for that

Change-Id: I729aed6329fe0988fcb9b4407f16966a753b3204
2021-07-06 17:26:51 -04:00

33 lines
597 B
Go

// Copyright (C) 2021 Storj Labs, Inc.
// See LICENSE for copying information.
package main
import (
"github.com/zeebo/clingy"
"github.com/zeebo/errs"
)
type cmdMb struct {
projectProvider
name string
}
func (c *cmdMb) Setup(params clingy.Parameters) {
c.projectProvider.Setup(params)
c.name = params.Arg("name", "Bucket name (sj://BUCKET)").(string)
}
func (c *cmdMb) Execute(ctx clingy.Context) error {
project, err := c.OpenProject(ctx)
if err != nil {
return errs.Wrap(err)
}
defer func() { _ = project.Close() }()
_, err = project.CreateBucket(ctx, c.name)
return err
}