summaryrefslogtreecommitdiff
path: root/conf/list.go
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-05-13 22:32:24 -0500
committersanine <sanine.not@pm.me>2023-05-13 22:32:24 -0500
commit9571ccc4d87907067df98edeaa78f0c167fcff43 (patch)
treee64760fa34d7ecfd8460596b8ddf314ceacda2b7 /conf/list.go
parent609ef3f3b4d4cb355d80b19df1e91db258b0bbe0 (diff)
begin total refactor
Diffstat (limited to 'conf/list.go')
-rw-r--r--conf/list.go69
1 files changed, 0 insertions, 69 deletions
diff --git a/conf/list.go b/conf/list.go
deleted file mode 100644
index 4fa3829..0000000
--- a/conf/list.go
+++ /dev/null
@@ -1,69 +0,0 @@
-package main
-
-import(
- "fmt"
- "log"
- "time"
-)
-
-
-var listUsers = Command{
- Name: "users",
- Execute: func([]string) {
- users, err := p.AllUsers()
- if err != nil {
- log.Fatal(err)
- }
- fmt.Printf("id\tname\n========================================\n")
- for _, user := range users {
- fmt.Printf("%v\t%v\n", user.Id, user.Name)
- }
- },
-}
-
-
-var listSessions = Command{
- Name: "sessions",
- Execute: func([]string) {
- sessions, err := p.AllSessions()
- if err != nil {
- log.Fatal(err)
- }
- // padding on created and modified to match RFC3339 format
- fmt.Printf("user\t\tcreated \tmodified \tid\n================================================================================\n")
- for _, session := range sessions {
- user, err := p.GetById(session.UserId)
- if err != nil {
- log.Fatal(err)
- }
- fmt.Printf("%v\t\t%v\t%v\t%v\n", user.Name, session.Created.Format(time.RFC3339), session.Modified.Format(time.RFC3339), session.Id)
- }
- },
-}
-
-
-var listEndpoints = Command{
- Name: "endpoints",
- Execute: func([]string) {
- endpoints, err := p.AllEndpoints()
- if err != nil { log.Fatal(err) }
-
- fmt.Printf("name\tpath\taddress\n========================================\n")
- for _, endpoint := range endpoints {
- fmt.Printf("%v\t%v\t%v\n", endpoint.Name, endpoint.Path, endpoint.Address)
- }
- },
-}
-
-
-func ListInit(parser *Command) {
- list := &Command{
- Name: "list",
- Branch: true,
- }
-
- list.AddCommand(&listUsers)
- list.AddCommand(&listSessions)
- list.AddCommand(&listEndpoints)
- parser.AddCommand(list)
-}