summaryrefslogtreecommitdiff
path: root/cmd/redqctl
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-07-04 13:13:23 +0530
committersinanmohd <sinan@sinanmohd.com>2024-07-05 17:02:06 +0530
commite2f67996a608346ea3f3525ef2febf6ca5d2b78c (patch)
tree932f766b65ed5a6ff3d57c772292a2b75210d9aa /cmd/redqctl
parente309091d17720b69c53172a41c0ea45ad7b66911 (diff)
refactor: drop http api, move to sqlc/postgresql
Diffstat (limited to 'cmd/redqctl')
-rw-r--r--cmd/redqctl/main.go74
1 files changed, 0 insertions, 74 deletions
diff --git a/cmd/redqctl/main.go b/cmd/redqctl/main.go
deleted file mode 100644
index ce77f77..0000000
--- a/cmd/redqctl/main.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package main
-
-import (
- "flag"
- "fmt"
- "log"
- "os"
-
- redqdb "sinanmohd.com/redq/db"
-)
-
-func help() {
- const helpString string =
-`redqctl is a tool for managing redq.
-
-Usage:
-
- redqctl <command> [arguments]
-
-The commands are:
-
- create create a redq account
- help show this help cruft
-
-`
-
- fmt.Print(helpString)
-}
-
-func create(args []string, db *redqdb.SafeDB) {
- f := flag.NewFlagSet("create", flag.ExitOnError)
- ac := &redqdb.Account{}
- ac.Info = &redqdb.Login{}
-
- f.StringVar(&ac.UserName, "username", "",
- "The username to associate with the account")
- f.StringVar(&ac.Info.FirstName, "fname", "",
- "The first name to associate with the account")
- f.StringVar(&ac.Info.LastName, "lname", "",
- "The last name to associate with the account")
- f.StringVar(&ac.Password, "pass", "",
- "The password to associate with the account")
- f.UintVar(&ac.Info.Level, "level", 0,
- "The level to associate with the account")
- f.Parse(args)
-
- err := ac.CreateAccount(db)
- if err != nil {
- log.Fatal(err)
- }
-}
-
-func main() {
- args := os.Args[1:]
- if len(args) == 0 {
- help()
- os.Exit(2)
- }
-
- db, err := redqdb.NewSafeDB()
- if err != nil {
- log.Fatal(err)
- }
-
- switch args[0] {
- case "help":
- help()
- case "create":
- create(args[1:], db)
- default:
- help()
- os.Exit(2)
- }
-}