| 
									
										
										
										
											2024-12-04 11:48:05 -06:00
										 |  |  | 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) | 
					
						
							| 
									
										
										
										
											2025-04-24 14:27:19 -05:00
										 |  |  | 		msg := "Waiting for CPU to cool, for " + path | 
					
						
							| 
									
										
										
										
											2024-12-04 11:48:05 -06:00
										 |  |  | 		sp := spin.Spin(ct, msg) | 
					
						
							|  |  |  | 		err := sp.Wait() | 
					
						
							|  |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			return err | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return gs(s, path) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } |