code: func (c *Config) Save() error {
  	if err := c.checkDefaults(); err != nil {
  		return err
  	}
  
  	buf, err := yaml.Marshal(c)
  	if err != nil {
  		return errors.Wrapf(err, "failed to marshal YAML")
  	}
  
  	cfgLoc := configLocation()
  	cfgDir := filepath.Dir(cfgLoc)
  	if !fsutil.IsDir(cfgDir) {
  		if err := os.MkdirAll(cfgDir, 0700); err != nil {
  			return errors.Wrapf(err, "failed to create dir '%s'", cfgDir)
  		}
  	}
  	if err := ioutil.WriteFile(cfgLoc, buf, 0600); err != nil {
  		return errors.Wrapf(err, "failed to write config file to '%s'", cfgLoc)
  	}
  	if debug {
  		fmt.Printf("[DEBUG] Saved config to %s: %+v\n", cfgLoc, c)
  	}
  	return nil
  }
docs: // Save saves the config