mirror of
				https://github.com/traefik/traefik.git
				synced 2025-10-31 08:21:27 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			598 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			598 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package cli
 | |
| 
 | |
| import (
 | |
| 	"fmt"
 | |
| 
 | |
| 	"github.com/rs/zerolog/log"
 | |
| 	"github.com/traefik/paerser/cli"
 | |
| 	"github.com/traefik/paerser/flag"
 | |
| )
 | |
| 
 | |
| // FlagLoader loads configuration from flags.
 | |
| type FlagLoader struct{}
 | |
| 
 | |
| // Load loads the command's configuration from flag arguments.
 | |
| func (*FlagLoader) Load(args []string, cmd *cli.Command) (bool, error) {
 | |
| 	if len(args) == 0 {
 | |
| 		return false, nil
 | |
| 	}
 | |
| 
 | |
| 	if err := flag.Decode(args, cmd.Configuration); err != nil {
 | |
| 		return false, fmt.Errorf("failed to decode configuration from flags: %w", err)
 | |
| 	}
 | |
| 
 | |
| 	log.Print("Configuration loaded from flags")
 | |
| 
 | |
| 	return true, nil
 | |
| }
 |