(args []string)
| 758 | } |
| 759 | |
| 760 | func (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. |
| 798 | func (e *Evaluator) REPLConfig() string { |
no test coverage detected