From 2403292e63a1ca043406dee59ae321de7136c01e Mon Sep 17 00:00:00 2001 From: CamrynCarter Date: Mon, 27 Jul 2026 16:19:48 -0700 Subject: [PATCH] update manifest name to match store by default --- cmd/hauler/cli/store.go | 5 ++++- cmd/hauler/cli/store/create_manifest.go | 13 +++++++++---- internal/flags/create.go | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cmd/hauler/cli/store.go b/cmd/hauler/cli/store.go index eba7d3a..53e7f6f 100644 --- a/cmd/hauler/cli/store.go +++ b/cmd/hauler/cli/store.go @@ -517,9 +517,12 @@ func addStoreCreateManifest(rso *flags.StoreRootOpts, ro *flags.CliRootOpts) *co cmd := &cobra.Command{ Use: "manifest", Short: "Create a hauler content manifest from the store's metadata", - Example: ` # generate a manifest for the default store into ./hauler-manifest.yaml + Example: ` # generate a manifest for the default store into ./store-manifest.yaml hauler store create manifest + # generate a manifest for a specific store into ./my-store-manifest.yaml + hauler store create manifest --store /path/to/my-store + # generate a manifest for a specific store into a custom path hauler store create manifest --store /path/to/store --output my-manifest.yaml`, Args: cobra.ExactArgs(0), diff --git a/cmd/hauler/cli/store/create_manifest.go b/cmd/hauler/cli/store/create_manifest.go index 2c76cc6..2457b50 100644 --- a/cmd/hauler/cli/store/create_manifest.go +++ b/cmd/hauler/cli/store/create_manifest.go @@ -184,6 +184,11 @@ func CreateManifestCmd(ctx context.Context, o *flags.CreateManifestOpts, s *stor base := sanitizeName(filepath.Base(s.Root)) + output := o.Output + if output == "" { + output = base + "-manifest.yaml" + } + var out strings.Builder if len(images) > 0 { if err := writeDoc(&out, "", consts.ImagesContentKind, base+"-images", struct { @@ -211,12 +216,12 @@ func CreateManifestCmd(ctx context.Context, o *flags.CreateManifestOpts, s *stor } } - if err := os.WriteFile(o.Output, []byte(out.String()), 0o644); err != nil { - return fmt.Errorf("writing manifest to [%s]: %w", o.Output, err) + if err := os.WriteFile(output, []byte(out.String()), 0o644); err != nil { + return fmt.Errorf("writing manifest to [%s]: %w", output, err) } - outPath := o.Output - if abs, err := filepath.Abs(o.Output); err == nil { + outPath := output + if abs, err := filepath.Abs(output); err == nil { outPath = abs } l.Infof("wrote manifest with [%d] image(s), [%d] chart(s), [%d] file(s) to [%s]", len(images), len(charts), len(files), outPath) diff --git a/internal/flags/create.go b/internal/flags/create.go index e900e66..f97e5f8 100644 --- a/internal/flags/create.go +++ b/internal/flags/create.go @@ -11,5 +11,5 @@ type CreateManifestOpts struct { func (o *CreateManifestOpts) AddFlags(cmd *cobra.Command) { f := cmd.Flags() - f.StringVarP(&o.Output, "output", "o", "hauler-manifest.yaml", "(Optional) Path to write the generated manifest to") + f.StringVarP(&o.Output, "output", "o", "", "(Optional) Path to write the generated manifest to (default \"$STORENAME-manifest.yaml\")") }