diff --git a/cmd/dist/apply.go b/cmd/dist/apply.go new file mode 100644 index 0000000..bb5858c --- /dev/null +++ b/cmd/dist/apply.go @@ -0,0 +1,30 @@ +package main + +import ( + contextpkg "context" + "os" + + "github.com/docker/containerd/log" + "github.com/docker/docker/pkg/archive" + "github.com/urfave/cli" +) + +var applyCommand = cli.Command{ + Name: "apply", + Usage: "apply layer from stdin to dir", + ArgsUsage: "[flags] ", + Flags: []cli.Flag{}, + Action: func(context *cli.Context) error { + var ( + ctx = contextpkg.Background() + dir = context.Args().First() + ) + + log.G(ctx).Info("applying layer from stdin") + if _, err := archive.ApplyLayer(dir, os.Stdin); err != nil { + return err + } + + return nil + }, +} diff --git a/cmd/dist/main.go b/cmd/dist/main.go index ece885e..5a19608 100644 --- a/cmd/dist/main.go +++ b/cmd/dist/main.go @@ -35,6 +35,7 @@ distribution tool pathCommand, deleteCommand, listCommand, + applyCommand, } app.Before = func(context *cli.Context) error { if context.GlobalBool("debug") {