cmd.go 503 B

12345678910111213141516171819202122232425
  1. package config
  2. import (
  3. "gitlab.com/beeper/discord/globals"
  4. )
  5. type Cmd struct {
  6. HomeserverAddress string `kong:"arg,help='The url to for the homeserver',required='1'"`
  7. Domain string `kong:"arg,help='The domain for the homeserver',required='1'"`
  8. }
  9. func (c *Cmd) Run(g *globals.Globals) error {
  10. cfg := &Config{
  11. Homeserver: homeserver{
  12. Address: c.HomeserverAddress,
  13. Domain: c.Domain,
  14. },
  15. }
  16. if err := cfg.validate(); err != nil {
  17. return err
  18. }
  19. return cfg.Save(g.Config)
  20. }