github.com/TrueBlocks/trueblocks-core/src/apps/chifra@v0.0.0-20241022031540-b362680128f7/internal/explore/handle_show.go (about)

     1  package explorePkg
     2  
     3  import (
     4  	"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output"
     5  	"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types"
     6  	"github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/utils"
     7  )
     8  
     9  func (opts *ExploreOptions) HandleShow(rCtx *output.RenderCtx) error {
    10  	fetchData := func(modelChan chan types.Modeler, errorChan chan error) {
    11  		for _, dest := range opts.Destinations {
    12  			dests := dest.Resolve(opts.Globals.Chain, opts.Google, opts.Dalle, opts.Local)
    13  			for _, d := range dests {
    14  				if !opts.NoOpen && !opts.Globals.TestMode {
    15  					utils.OpenBrowser(d.Url)
    16  				}
    17  				modelChan <- &d
    18  			}
    19  		}
    20  	}
    21  
    22  	return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOpts())
    23  }