mirror of
				https://github.com/juanfont/headscale.git
				synced 2025-11-04 01:51:04 +01:00 
			
		
		
		
	Add helper function for colouring expiries
This commit is contained in:
		
							parent
							
								
									f9137f3bb0
								
							
						
					
					
						commit
						b4259fcd79
					
				
							
								
								
									
										20
									
								
								cmd/headscale/cli/pterm_style.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								cmd/headscale/cli/pterm_style.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,20 @@
 | 
			
		||||
package cli
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/pterm/pterm"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func ColourTime(date time.Time) string {
 | 
			
		||||
	dateStr := date.Format("2006-01-02 15:04:05")
 | 
			
		||||
	now := time.Now()
 | 
			
		||||
 | 
			
		||||
	if date.After(now) {
 | 
			
		||||
		dateStr = pterm.LightGreen(dateStr)
 | 
			
		||||
	} else {
 | 
			
		||||
		dateStr = pterm.LightRed(dateStr)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return dateStr
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user