Skip to content

Commit

Permalink
✨ Exporters: show description and name of exporters activated for the…
Browse files Browse the repository at this point in the history
… build
  • Loading branch information
ewen-lbh committed Apr 14, 2024
1 parent 46a3a02 commit 54ca2bf
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Cloud exporter: uses rclone to upload the database.json file to many cloud services
- Requires key in exporter manifests to specify programs required to run the exporter

### Changed

- building now shows exporters that are activated along with their description

## [1.1.0] - 2024-04-14

### Added
Expand Down
1 change: 1 addition & 0 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ func PrepareBuild(databaseDirectory string, outputFilename string, flags Flags,
return &ctx, err
}

LogCustom("Using", "magenta", "exporter [bold]%s[reset]\n[dim]%s", exporter.Name(), exporter.Description())
err = exporter.Before(&ctx, options)
if err != nil {
return &ctx, fmt.Errorf("while running exporter %s before hook: %w", exporter.Name(), err)
Expand Down
4 changes: 4 additions & 0 deletions exporter_custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ func (e *CustomExporter) Name() string {
return e.name
}

func (e *CustomExporter) Description() string {
return e.manifest.Description
}

func (e *CustomExporter) OptionsType() any {
return e.manifest.Data
}
Expand Down
4 changes: 4 additions & 0 deletions exporter_sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ func (e *SqlExporter) Name() string {
return "sql"
}

func (e *SqlExporter) Description() string {
return "Export the database as SQL statements. Rudimentary for now."
}

func (e *SqlExporter) Before(ctx *RunContext, opts ExporterOptions) error {
e.result = ""
if !fileExists(e.outputFilename(ctx)) {
Expand Down
1 change: 1 addition & 0 deletions exporters.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type ExporterOptions interface{}

type Exporter interface {
Name() string
Description() string
Before(ctx *RunContext, opts ExporterOptions) error
Export(ctx *RunContext, opts ExporterOptions, work *AnalyzedWork) error
After(ctx *RunContext, opts ExporterOptions, built *Database) error
Expand Down

0 comments on commit 54ca2bf

Please sign in to comment.