mirror of
				https://github.com/juanfont/headscale.git
				synced 2025-10-28 10:51:44 +01:00 
			
		
		
		
	jagottsicher's fork fixed a bug in Windows implementation. While Windows may be not intended as a target platform, some contributors may prefer it for development. Also ran go mod tidy, thus two more unnecessary packages are removed from go.sum
		
			
				
	
	
		
			44 lines
		
	
	
		
			877 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			877 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package main
 | |
| 
 | |
| import (
 | |
| 	"os"
 | |
| 	"time"
 | |
| 
 | |
| 	"github.com/jagottsicher/termcolor"
 | |
| 	"github.com/juanfont/headscale/cmd/headscale/cli"
 | |
| 	"github.com/rs/zerolog"
 | |
| 	"github.com/rs/zerolog/log"
 | |
| )
 | |
| 
 | |
| func main() {
 | |
| 	var colors bool
 | |
| 	switch l := termcolor.SupportLevel(os.Stderr); l {
 | |
| 	case termcolor.Level16M:
 | |
| 		colors = true
 | |
| 	case termcolor.Level256:
 | |
| 		colors = true
 | |
| 	case termcolor.LevelBasic:
 | |
| 		colors = true
 | |
| 	case termcolor.LevelNone:
 | |
| 		colors = false
 | |
| 	default:
 | |
| 		// no color, return text as is.
 | |
| 		colors = false
 | |
| 	}
 | |
| 
 | |
| 	// Adhere to no-color.org manifesto of allowing users to
 | |
| 	// turn off color in cli/services
 | |
| 	if _, noColorIsSet := os.LookupEnv("NO_COLOR"); noColorIsSet {
 | |
| 		colors = false
 | |
| 	}
 | |
| 
 | |
| 	zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
 | |
| 	log.Logger = log.Output(zerolog.ConsoleWriter{
 | |
| 		Out:        os.Stderr,
 | |
| 		TimeFormat: time.RFC3339,
 | |
| 		NoColor:    !colors,
 | |
| 	})
 | |
| 
 | |
| 	cli.Execute()
 | |
| }
 |