diff options
author | Michael Muré <batolettre@gmail.com> | 2019-11-26 20:46:00 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2019-11-26 20:46:00 +0100 |
commit | 1a1e313f3028243680c29520d96f722092a2bd38 (patch) | |
tree | a85ca33f431caa2bb06ad1dc1a77965ce9fa1feb /bridge/core | |
parent | 4f856d6f78f8ffe1795a71195244e5a332ac3215 (diff) | |
download | git-bug-1a1e313f3028243680c29520d96f722092a2bd38.tar.gz |
bridge: move export event handling to the CLI
Diffstat (limited to 'bridge/core')
-rw-r--r-- | bridge/core/bridge.go | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/bridge/core/bridge.go b/bridge/core/bridge.go index 3a36dfaa..1cad10e9 100644 --- a/bridge/core/bridge.go +++ b/bridge/core/bridge.go @@ -365,39 +365,21 @@ func (b *Bridge) ImportAll(ctx context.Context) (<-chan ImportResult, error) { return b.ImportAllSince(ctx, time.Time{}) } -func (b *Bridge) ExportAll(ctx context.Context, since time.Time) error { +func (b *Bridge) ExportAll(ctx context.Context, since time.Time) (<-chan ExportResult, error) { exporter := b.getExporter() if exporter == nil { - return ErrExportNotSupported + return nil, ErrExportNotSupported } err := b.ensureConfig() if err != nil { - return err + return nil, err } err = b.ensureInit() if err != nil { - return err - } - - events, err := exporter.ExportAll(ctx, b.repo, since) - if err != nil { - return err - } - - exportedIssues := 0 - for result := range events { - if result.Event != ExportEventNothing { - fmt.Println(result.String()) - } - - switch result.Event { - case ExportEventBug: - exportedIssues++ - } + return nil, err } - fmt.Printf("exported %d issues with %s bridge\n", exportedIssues, b.Name) - return nil + return exporter.ExportAll(ctx, b.repo, since) } |