-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show spinner while pushing package (#350)
- Loading branch information
1 parent
c316549
commit d57bc94
Showing
2 changed files
with
15 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ import ( | |
"github.com/MakeNowJust/heredoc" | ||
"github.com/buildkite/cli/v3/pkg/cmd/factory" | ||
"github.com/buildkite/go-buildkite/v3/buildkite" | ||
"github.com/charmbracelet/huh/spinner" | ||
"github.com/spf13/cobra" | ||
"github.com/spf13/pflag" | ||
) | ||
|
@@ -63,10 +64,19 @@ func NewCmdPackagePush(f *factory.Factory) *cobra.Command { | |
panic("Neither file path nor stdin file name are available, there has been an error in the config validation. Report this to [email protected]") | ||
} | ||
|
||
pkg, _, err := f.RestAPIClient.PackagesService.Create(f.Config.OrganizationSlug(), cfg.RegistrySlug, buildkite.CreatePackageInput{ | ||
Filename: packageName, | ||
Package: from, | ||
}) | ||
var pkg buildkite.Package | ||
spinErr := spinner.New(). | ||
Title("Pushing package"). | ||
Action(func() { | ||
pkg, _, err = f.RestAPIClient.PackagesService.Create(f.Config.OrganizationSlug(), cfg.RegistrySlug, buildkite.CreatePackageInput{ | ||
Filename: packageName, | ||
Package: from, | ||
}) | ||
}). | ||
Run() | ||
if spinErr != nil { | ||
return spinErr | ||
} | ||
if err != nil { | ||
return fmt.Errorf("%w: request to create package failed: %w", ErrAPIError, err) | ||
} | ||
|