diff options
Diffstat (limited to 'conf/list.go')
-rw-r--r-- | conf/list.go | 69 |
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) -} |