Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buildkite Package Registries command help wording fixes. #440

Merged
merged 2 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/cmd/pkg/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func NewCmdPackage(f *factory.Factory) *cobra.Command {
Use: "package <command>",
Aliases: []string{"pkg"},
Short: "Manage packages",
Long: "Work with Buildkite Packages",
Long: "Work with Buildkite Package Registries",
PersistentPreRunE: validation.CheckValidConfiguration(f.Config),
}

Expand Down
22 changes: 11 additions & 11 deletions pkg/cmd/pkg/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ func NewCmdPackagePush(f *factory.Factory) *cobra.Command {
var web bool

cmd := cobra.Command{
Use: "push registry-name {path/to/file | --stdin-file-name filename -}",
Short: "Push a new package to Buildkite Packages",
Use: "push registry-slug {path/to/file | --stdin-file-name filename -}",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An important change, considering slugs and names are distinctly different.

Short: "Push a new package to a Buildkite registry",
Long: heredoc.Doc(`
Push a new package to Buildkite Packages. The package can be passed as a path to a file in the second positional argument,
or via stdin. If passed via stdin, the filename must be provided with the --stdin-file-name flag, as Buildkite
Packages requires a filename for the package.`),
Push a new package to a Buildkite registry. The package can be passed as a path to a file in the second positional argument,
Copy link
Contributor Author

@gilesgas gilesgas Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A "Buildkite registry" is more accurate/specific than the former product name "Buildkite Packages", and less cumbersome than referring to this type of registry as a "Buildkite Package Registries registry".

or via stdin. If passed via stdin, the filename must be provided with the --stdin-file-name flag, as a Buildkite
registry requires a filename for the package.`),
Example: heredoc.Doc(`
Push a package to a Buildkite registry
The web URL of the uploaded package will be printed to stdout.
Expand Down Expand Up @@ -74,7 +74,7 @@ func NewCmdPackagePush(f *factory.Factory) *cobra.Command {
}

var pkg buildkite.Package
spinErr := bk_io.SpinWhile("Pushing package", func() {
spinErr := bk_io.SpinWhile("Pushing file", func() {
pkg, _, err = f.RestAPIClient.PackagesService.Create(cmd.Context(), f.Config.OrganizationSlug(), cfg.RegistrySlug, buildkite.CreatePackageInput{
Filename: packageName,
Package: from,
Expand All @@ -87,13 +87,13 @@ func NewCmdPackagePush(f *factory.Factory) *cobra.Command {
return fmt.Errorf("%w: request to create package failed: %w", ErrAPIError, err)
}

fmt.Fprintf(cmd.OutOrStdout(), "Created package: %s\n", pkg.Name)
fmt.Fprintf(cmd.OutOrStdout(), "View it on the web at: %s\n", pkg.WebURL)
fmt.Fprintf(cmd.OutOrStdout(), "Created package file: %s\n", pkg.Name)
fmt.Fprintf(cmd.OutOrStdout(), "View this file on the web at: %s\n", pkg.WebURL)
return util.OpenInWebBrowser(web, pkg.WebURL)
},
}

cmd.Flags().StringP(stdinFileNameFlag, "n", "", "The filename to use for the package, if it's passed via stdin. Invalid otherwise.")
cmd.Flags().StringP(stdinFileNameFlag, "n", "", "The name to use for the package file, if it is passed via stdin. Invalid otherwise.")
cmd.Flags().BoolVarP(&web, "web", "w", false, "Open in a web browser the package information after it has been uploaded.")

return &cmd
Expand Down Expand Up @@ -136,12 +136,12 @@ func loadAndValidateConfig(flags *pflag.FlagSet, args []string) (*pushPackageCon
}

if args[1] == "-" && stdinFileName.Value.String() == "" {
return nil, fmt.Errorf("%w: When passing a package via stdin, the --stdin-file-name flag must be provided", ErrInvalidConfig)
return nil, fmt.Errorf("%w: When passing a package file via stdin, the --stdin-file-name flag must be provided", ErrInvalidConfig)
}

if stdinFileName.Value.String() != "" {
if args[1] != "-" {
return nil, fmt.Errorf("%w: When passing a package via stdin, the final argument must be '-'", ErrInvalidConfig)
return nil, fmt.Errorf("%w: When passing a package file via stdin, the final argument must be '-'", ErrInvalidConfig)
}

stdInReadable, err := isStdInReadableFunc()
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/pkg/push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestPackagePush(t *testing.T) {
stdin: strings.NewReader("test package stream contents!"),
args: []string{"my-registry", "-"},
wantErr: ErrInvalidConfig,
wantErrContain: "When passing a package via stdin, the --stdin-file-name flag must be provided",
wantErrContain: "When passing a package file via stdin, the --stdin-file-name flag must be provided",
},

// Happy paths
Expand Down