From 527de7dc2a66c08097bab59126c50cacdb579b3b Mon Sep 17 00:00:00 2001 From: Fred Lotter Date: Sat, 5 Oct 2024 16:55:51 +0200 Subject: [PATCH 01/15] feat(plan): add support for 1 sub-dir level --- client/plan.go | 7 ++ internals/cli/cmd_add.go | 3 + internals/daemon/api_plan.go | 1 + internals/plan/plan.go | 230 +++++++++++++++++++++++++++++++---- 4 files changed, 215 insertions(+), 26 deletions(-) diff --git a/client/plan.go b/client/plan.go index 25b447f08..481c7e950 100644 --- a/client/plan.go +++ b/client/plan.go @@ -25,6 +25,11 @@ type AddLayerOptions struct { // has the given label. False (the default) means append a new layer. Combine bool + // Inner true means a new layer append may go into an existing + // subdirectory, even through it may not result in appending it + // to the end of the layers slice (it becomes an insert). + Inner bool + // Label is the label for the new layer if appending, and the label of the // layer to combine with if Combine is true. Label string @@ -38,12 +43,14 @@ func (client *Client) AddLayer(opts *AddLayerOptions) error { var payload = struct { Action string `json:"action"` Combine bool `json:"combine"` + Inner bool `json:"inner"` Label string `json:"label"` Format string `json:"format"` Layer string `json:"layer"` }{ Action: "add", Combine: opts.Combine, + Inner: opts.Inner, Label: opts.Label, Format: "yaml", Layer: string(opts.LayerData), diff --git a/internals/cli/cmd_add.go b/internals/cli/cmd_add.go index 1d8e841cd..247a4d6c8 100644 --- a/internals/cli/cmd_add.go +++ b/internals/cli/cmd_add.go @@ -35,6 +35,7 @@ type cmdAdd struct { client *client.Client Combine bool `long:"combine"` + Inner bool `long:"inner"` Positional struct { Label string `positional-arg-name:"