28 lines
		
	
	
	
		
			621 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
	
		
			621 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package convids
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 	"io"
 | |
| 
 | |
| 	"codeberg.org/danjones000/utils/chill"
 | |
| 	"codeberg.org/danjones000/utils/cli/spin"
 | |
| 	conutils "codeberg.org/danjones000/utils/convids"
 | |
| )
 | |
| 
 | |
| func GetWalker(ctx context.Context, dryRun bool, in io.Reader, out, errOut io.Writer) conutils.ShowWalker {
 | |
| 	if dryRun {
 | |
| 		return conutils.DryRun(out)
 | |
| 	}
 | |
| 
 | |
| 	gs := conutils.GetShowWithIO(ctx, in, out, errOut)
 | |
| 	return func(s *conutils.Show, path string) error {
 | |
| 		ct := chill.Chill(ctx)
 | |
| 		msg := "Waiting for CPU to cool, for " + path
 | |
| 		sp := spin.Spin(ct, msg)
 | |
| 		err := sp.Wait()
 | |
| 		if err != nil {
 | |
| 			return err
 | |
| 		}
 | |
| 		return gs(s, path)
 | |
| 	}
 | |
| }
 |