MCPcopy Create free account
hub / github.com/cel-expr/cel-go / handleConfig

Method handleConfig

repl/evaluator.go:760–795  ·  view source on GitHub ↗
(args []string)

Source from the content-addressed store, hash-verified

758}
759
760func (e *Evaluator) handleConfig(args []string) (string, error) {
761 format := statusFormatREPL
762 var fromFile bool
763 var configRef string
764 for _, a := range args {
765 switch a {
766 case "--yaml":
767 format = statusFormatYAML
768 case "--repl":
769 format = statusFormatREPL
770 case "--file":
771 fromFile = true
772 default:
773 configRef = a
774 }
775 }
776
777 if configRef == "" {
778 return "", errors.New("config: no config provided")
779 }
780 src := []byte(configRef)
781 if fromFile {
782 tmp, err := os.ReadFile(configRef)
783 if err != nil {
784 return "", fmt.Errorf("configure: %w", err)
785 }
786 src = tmp
787 }
788
789 switch format {
790 case statusFormatYAML:
791 return e.parseYAMLConfig(src)
792 }
793
794 return "", fmt.Errorf("configure: not yet implemented %v %v %v ", format, fromFile, configRef)
795}
796
797// REPLConfig returns a stringified view of the current evaluator state in terms of REPL Commands.
798func (e *Evaluator) REPLConfig() string {

Callers 1

ProcessMethod · 0.95

Calls 2

parseYAMLConfigMethod · 0.95
NewMethod · 0.80

Tested by

no test coverage detected