mirror of
https://github.com/hanzoai/ingress-parser.git
synced 2026-10-30 18:33:22 +00:00
Rebrand module path, DefaultNamePrefix TRAEFIK_ -> INGRESS_, DefaultRootName traefik -> ingress, config paths /etc/traefik -> /etc/ingress. All 7 packages pass tests.
24 lines
491 B
Go
24 lines
491 B
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/hanzoai/ingress-parser/flag"
|
|
)
|
|
|
|
// FlagLoader loads configuration from flags.
|
|
type FlagLoader struct{}
|
|
|
|
// Load loads the command's configuration from flag arguments.
|
|
func (*FlagLoader) Load(args []string, cmd *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)
|
|
}
|
|
|
|
return true, nil
|
|
}
|