Skip to content

Commit

Permalink
Change --format=cnb to --format=file
Browse files Browse the repository at this point in the history
Signed-off-by: Javier Romero <[email protected]>
  • Loading branch information
jromero committed Mar 23, 2020
1 parent 000c7d0 commit 22a14e0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1236,14 +1236,14 @@ func testAcceptance(t *testing.T, when spec.G, it spec.S, packFixturesDir, packP
})
})

when("--format cnb", func() {
when("--format file", func() {
it.Before(func() {
h.SkipIf(t, !packSupports(packPath, "package-buildpack --format"), "format not supported")
})

it("creates the package", func() {
outputFile := filepath.Join(tmpDir, "package.cnb")
output, err := h.RunE(subjectPack("package-buildpack", outputFile, "--format", "cnb", "-p", filepath.Join(tmpDir, "package.toml")))
output, err := h.RunE(subjectPack("package-buildpack", outputFile, "--format", "file", "-p", filepath.Join(tmpDir, "package.toml")))
h.AssertNil(t, err)
h.AssertContains(t, output, fmt.Sprintf("Successfully created package '%s'", outputFile))
h.AssertTarball(t, outputFile)
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/package_buildpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func PackageBuildpack(logger logging.Logger, client BuildpackPackager, packageCo
}
cmd.Flags().StringVarP(&flags.PackageTomlPath, "package-config", "p", "", "Path to package TOML config (required)")
cmd.MarkFlagRequired("package-config")
cmd.Flags().StringVarP(&flags.Format, "format", "f", "", `Format to save package as ("image" or "cnb")`)
cmd.Flags().StringVarP(&flags.Format, "format", "f", "", `Format to save package as ("image" or "file")`)
cmd.Flags().BoolVar(&flags.Publish, "publish", false, `Publish to registry (applies to "--image" only)`)
cmd.Flags().BoolVar(&flags.NoPull, "no-pull", false, "Skip pulling packages before use")
AddHelpFlag(cmd, "package-buildpack")
Expand Down
4 changes: 2 additions & 2 deletions package_buildpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

const (
FormatImage = "image"
FormatCNB = "cnb"
FormatFile = "file"
)

type PackageBuildpackOptions struct {
Expand Down Expand Up @@ -74,7 +74,7 @@ func (c *Client) PackageBuildpack(ctx context.Context, opts PackageBuildpackOpti
}

switch opts.Format {
case FormatCNB:
case FormatFile:
return packageBuilder.SaveAsFile(opts.Name)
case FormatImage:
_, err = packageBuilder.SaveAsImage(opts.Name, opts.Publish)
Expand Down

0 comments on commit 22a14e0

Please sign in to comment.