()
| 28 | } |
| 29 | |
| 30 | func readConfig() { |
| 31 | cfgPath := filepath.Join(os.Getenv("HOME"), ".moby", "linuxkit", "config.yml") |
| 32 | cfgBytes, err := os.ReadFile(cfgPath) |
| 33 | if err != nil { |
| 34 | if os.IsNotExist(err) { |
| 35 | return |
| 36 | } |
| 37 | fmt.Printf("Failed to read %q\n", cfgPath) |
| 38 | os.Exit(1) |
| 39 | } |
| 40 | if err := yaml.Unmarshal(cfgBytes, &Config); err != nil { |
| 41 | fmt.Printf("Failed to parse %q\n", cfgPath) |
| 42 | os.Exit(1) |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | func newCmd() *cobra.Command { |
| 47 | var ( |