Skip to content

Commit abcf935

Browse files
committed
update manifest name to match store by default
1 parent 0590345 commit abcf935

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

cmd/hauler/cli/store.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,12 @@ func addStoreCreateManifest(rso *flags.StoreRootOpts, ro *flags.CliRootOpts) *co
442442
cmd := &cobra.Command{
443443
Use: "manifest",
444444
Short: "Create a hauler content manifest from the store's metadata",
445-
Example: ` # generate a manifest for the default store into ./hauler-manifest.yaml
445+
Example: ` # generate a manifest for the default store into ./store-manifest.yaml
446446
hauler store create manifest
447447
448+
# generate a manifest for a specific store into ./my-store-manifest.yaml
449+
hauler store create manifest --store /path/to/my-store
450+
448451
# generate a manifest for a specific store into a custom path
449452
hauler store create manifest --store /path/to/store --output my-manifest.yaml`,
450453
Args: cobra.ExactArgs(0),

cmd/hauler/cli/store/create_manifest.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ func CreateManifestCmd(ctx context.Context, o *flags.CreateManifestOpts, s *stor
184184

185185
base := sanitizeName(filepath.Base(s.Root))
186186

187+
output := o.Output
188+
if output == "" {
189+
output = base + "-manifest.yaml"
190+
}
191+
187192
var out strings.Builder
188193
if len(images) > 0 {
189194
if err := writeDoc(&out, "", consts.ImagesContentKind, base+"-images", struct {
@@ -211,12 +216,12 @@ func CreateManifestCmd(ctx context.Context, o *flags.CreateManifestOpts, s *stor
211216
}
212217
}
213218

214-
if err := os.WriteFile(o.Output, []byte(out.String()), 0o644); err != nil {
215-
return fmt.Errorf("writing manifest to [%s]: %w", o.Output, err)
219+
if err := os.WriteFile(output, []byte(out.String()), 0o644); err != nil {
220+
return fmt.Errorf("writing manifest to [%s]: %w", output, err)
216221
}
217222

218-
outPath := o.Output
219-
if abs, err := filepath.Abs(o.Output); err == nil {
223+
outPath := output
224+
if abs, err := filepath.Abs(output); err == nil {
220225
outPath = abs
221226
}
222227
l.Infof("wrote manifest with [%d] image(s), [%d] chart(s), [%d] file(s) to [%s]", len(images), len(charts), len(files), outPath)

internal/flags/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ type CreateManifestOpts struct {
1111
func (o *CreateManifestOpts) AddFlags(cmd *cobra.Command) {
1212
f := cmd.Flags()
1313

14-
f.StringVarP(&o.Output, "output", "o", "hauler-manifest.yaml", "(Optional) Path to write the generated manifest to")
14+
f.StringVarP(&o.Output, "output", "o", "", "(Optional) Path to write the generated manifest to (default \"$STORENAME-manifest.yaml\")")
1515
}

0 commit comments

Comments
 (0)