Skip to content

Commit

Permalink
fix: CLI export (#2588)
Browse files Browse the repository at this point in the history
fix export
  • Loading branch information
mathnogueira committed May 25, 2023
1 parent bf4fb20 commit f0ac0ee
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions cli/actions/resource_actions.go
Expand Up @@ -93,12 +93,23 @@ func (r *resourceActions) Get(ctx context.Context, id string) (*file.File, error
}

func (r *resourceActions) Export(ctx context.Context, id string, filePath string) error {
file, err := r.actions.Get(ctx, id)
f, err := r.actions.Get(ctx, id)
if err != nil {
return err
}

_, err = file.WriteRaw()
formatter := formatters.BuildFormatter("", formatters.YAML, r.actions.Formatter())
content, err := formatter.Format(f)
if err != nil {
return err
}

newFile, err := file.NewFromRaw(filePath, []byte(content))
if err != nil {
return err
}

_, err = newFile.WriteRaw()
return err
}

Expand Down

0 comments on commit f0ac0ee

Please sign in to comment.