all repos — felt @ 4ea3e656d687f901f5d30c56d9196e9b99077dcb

virtual tabletop for dungeons and dragons (and similar) using Go, MongoDB, and websockets

cmd/cmd.go (raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package cmd

import (
	"fmt"
	"hacklab.nilfm.cc/quartzgun/auth"
	"strings"
)

func ProcessCmd(args []string, userStore auth.UserStore, cfg *Config) bool {
	if len(args) == 1 {
		return false
	}
	switch args[1] {
	case "adduser":
		if len(args) < 4 {
			return help()
		}
		userStore.AddUser(args[2], args[3])
	case "rmuser":
		if len(args) < 3 {
			return help()
		}
		userStore.DeleteUser(args[2])
	case "passwd":
		if len(args) < 5 {
			return help()
		}
		userStore.ChangePassword(args[2], args[3], args[4])
	default:
		help()
	}
	return true
}

func help() bool {
	return true
}