WriteConfig writes the configuration from ec.Config or input config
(config *Config)
| 805 | |
| 806 | // WriteConfig writes the configuration from ec.Config or input config |
| 807 | func (ec *ExecutionContext) WriteConfig(config *Config) error { |
| 808 | var op errors.Op = "cli.ExecutionContext.WriteConfig" |
| 809 | var cfg *Config |
| 810 | if config != nil { |
| 811 | cfg = config |
| 812 | } else { |
| 813 | cfg = ec.Config |
| 814 | } |
| 815 | buf := new(bytes.Buffer) |
| 816 | encoder := yaml.NewEncoder(buf) |
| 817 | encoder.SetIndent(2) |
| 818 | err := encoder.Encode(cfg) |
| 819 | if err != nil { |
| 820 | return errors.E(op, err) |
| 821 | } |
| 822 | err = ioutil.WriteFile(ec.ConfigFile, buf.Bytes(), 0644) |
| 823 | if err != nil { |
| 824 | return errors.E(op, err) |
| 825 | } |
| 826 | return nil |
| 827 | } |
| 828 | |
| 829 | type DefaultAPIPath string |
| 830 |
no outgoing calls
no test coverage detected