Skip to content

Commit

Permalink
manifest: add 'add' subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
husni-faiz committed May 2, 2023
1 parent e58ebf9 commit dfd9e22
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
7 changes: 7 additions & 0 deletions internal/commands/manifest_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@ func ManifestAdd(logger logging.Logger, pack PackClient) *cobra.Command {

indexName := args[0]
manifest := args[1]
all := false

if flags.All {
all = flags.All
}

if err := pack.AddManifest(cmd.Context(), client.AddManifestOptions{
Index: indexName,
Manifest: manifest,
All: all,
}); err != nil {
return err
}
Expand Down
21 changes: 14 additions & 7 deletions pkg/client/add_manifest.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
package client

import "context"
import (
"context"

"github.com/buildpacks/imgutil/local"
)

type AddManifestOptions struct {
Index string
Manifest string
Architecture string
OS string
Variant string
All bool
Index string
Manifest string
All bool
}

func (c *Client) AddManifest(ctx context.Context, opts AddManifestOptions) error {

err := local.AppendManifest(opts.Index, opts.Manifest)
if err != nil {
return err
}

return nil
}

0 comments on commit dfd9e22

Please sign in to comment.